1; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=hawaii -slp-vectorizer %s | FileCheck -check-prefixes=GCN,GFX7 %s 2; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -slp-vectorizer %s | FileCheck -check-prefixes=GCN,GFX8 %s 3; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -slp-vectorizer %s | FileCheck -check-prefixes=GCN,GFX8 %s 4 5define <2 x half> @round_v2f16(<2 x half> %arg) { 6; GFX7-LABEL: @round_v2f16( 7; GFX7-NEXT: bb: 8; GFX7-NEXT: [[T:%.*]] = extractelement <2 x half> [[ARG:%.*]], i64 0 9; GFX7-NEXT: [[T1:%.*]] = tail call half @llvm.round.f16(half [[T]]) 10; GFX7-NEXT: [[T2:%.*]] = insertelement <2 x half> undef, half [[T1]], i64 0 11; GFX7-NEXT: [[T3:%.*]] = extractelement <2 x half> [[ARG]], i64 1 12; GFX7-NEXT: [[T4:%.*]] = tail call half @llvm.round.f16(half [[T3]]) 13; GFX7-NEXT: [[T5:%.*]] = insertelement <2 x half> [[T2]], half [[T4]], i64 1 14; GFX7-NEXT: ret <2 x half> [[T5]] 15; 16; GFX8-LABEL: @round_v2f16( 17; GFX8-NEXT: bb: 18; GFX8-NEXT: [[TMP0:%.*]] = call <2 x half> @llvm.round.v2f16(<2 x half> [[ARG:%.*]]) 19; GFX8-NEXT: [[TMP1:%.*]] = extractelement <2 x half> [[TMP0]], i32 0 20; GFX8-NEXT: [[T2:%.*]] = insertelement <2 x half> undef, half [[TMP1]], i64 0 21; GFX8-NEXT: [[TMP2:%.*]] = extractelement <2 x half> [[TMP0]], i32 1 22; GFX8-NEXT: [[T5:%.*]] = insertelement <2 x half> [[T2]], half [[TMP2]], i64 1 23; GFX8-NEXT: ret <2 x half> [[T5]] 24; 25bb: 26 %t = extractelement <2 x half> %arg, i64 0 27 %t1 = tail call half @llvm.round.half(half %t) 28 %t2 = insertelement <2 x half> undef, half %t1, i64 0 29 %t3 = extractelement <2 x half> %arg, i64 1 30 %t4 = tail call half @llvm.round.half(half %t3) 31 %t5 = insertelement <2 x half> %t2, half %t4, i64 1 32 ret <2 x half> %t5 33} 34 35 36define <2 x float> @round_v2f32(<2 x float> %arg) { 37; GCN-LABEL: @round_v2f32( 38; GCN-NEXT: bb: 39; GCN-NEXT: [[T:%.*]] = extractelement <2 x float> [[ARG:%.*]], i64 0 40; GCN-NEXT: [[T1:%.*]] = tail call float @llvm.round.f32(float [[T]]) 41; GCN-NEXT: [[T2:%.*]] = insertelement <2 x float> undef, float [[T1]], i64 0 42; GCN-NEXT: [[T3:%.*]] = extractelement <2 x float> [[ARG]], i64 1 43; GCN-NEXT: [[T4:%.*]] = tail call float @llvm.round.f32(float [[T3]]) 44; GCN-NEXT: [[T5:%.*]] = insertelement <2 x float> [[T2]], float [[T4]], i64 1 45; GCN-NEXT: ret <2 x float> [[T5]] 46; 47bb: 48 %t = extractelement <2 x float> %arg, i64 0 49 %t1 = tail call float @llvm.round.f32(float %t) 50 %t2 = insertelement <2 x float> undef, float %t1, i64 0 51 %t3 = extractelement <2 x float> %arg, i64 1 52 %t4 = tail call float @llvm.round.f32(float %t3) 53 %t5 = insertelement <2 x float> %t2, float %t4, i64 1 54 ret <2 x float> %t5 55} 56 57declare half @llvm.round.half(half) #0 58declare float @llvm.round.f32(float) #0 59 60attributes #0 = { nounwind readnone speculatable willreturn } 61