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
5; GCN-LABEL: @round_v2f16(
6; GFX7: call half @llvm.round.f16(
7; GFX7: call half @llvm.round.f16(
8
9; GFX8: call <2 x half> @llvm.round.v2f16(
10define <2 x half> @round_v2f16(<2 x half> %arg) {
11bb:
12  %tmp = extractelement <2 x half> %arg, i64 0
13  %tmp1 = tail call half @llvm.round.half(half %tmp)
14  %tmp2 = insertelement <2 x half> undef, half %tmp1, i64 0
15  %tmp3 = extractelement <2 x half> %arg, i64 1
16  %tmp4 = tail call half @llvm.round.half(half %tmp3)
17  %tmp5 = insertelement <2 x half> %tmp2, half %tmp4, i64 1
18  ret <2 x half> %tmp5
19}
20
21; GCN-LABEL: @round_v2f32(
22; GCN: call float @llvm.round.f32(
23; GCN: call float @llvm.round.f32(
24define <2 x float> @round_v2f32(<2 x float> %arg) {
25bb:
26  %tmp = extractelement <2 x float> %arg, i64 0
27  %tmp1 = tail call float @llvm.round.f32(float %tmp)
28  %tmp2 = insertelement <2 x float> undef, float %tmp1, i64 0
29  %tmp3 = extractelement <2 x float> %arg, i64 1
30  %tmp4 = tail call float @llvm.round.f32(float %tmp3)
31  %tmp5 = insertelement <2 x float> %tmp2, float %tmp4, i64 1
32  ret <2 x float> %tmp5
33}
34
35declare half @llvm.round.half(half) #0
36declare float @llvm.round.f32(float) #0
37
38attributes #0 = { nounwind readnone speculatable willreturn }
39