1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc -global-isel -march=amdgcn -mcpu=hawaii -stop-after=instruction-select -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
4 define amdgpu_ps float @wqm_f32(float %val) {
5 ; GCN-LABEL: name: wqm_f32
6 ; GCN: bb.1 (%ir-block.0):
7 ; GCN-NEXT: liveins: $vgpr0
9 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
10 ; GCN-NEXT: [[WQM:%[0-9]+]]:vgpr_32 = WQM [[COPY]], implicit $exec
11 ; GCN-NEXT: $vgpr0 = COPY [[WQM]]
12 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0
13 %ret = call float @llvm.amdgcn.wqm.f32(float %val)
17 define amdgpu_ps float @wqm_v2f16(float %arg) {
18 ; GCN-LABEL: name: wqm_v2f16
19 ; GCN: bb.1 (%ir-block.0):
20 ; GCN-NEXT: liveins: $vgpr0
22 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
23 ; GCN-NEXT: [[WQM:%[0-9]+]]:vgpr_32 = WQM [[COPY]], implicit $exec
24 ; GCN-NEXT: $vgpr0 = COPY [[WQM]]
25 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0
26 %val = bitcast float %arg to <2 x half>
27 %ret = call <2 x half> @llvm.amdgcn.wqm.v2f16(<2 x half> %val)
28 %bc = bitcast <2 x half> %ret to float
32 define amdgpu_ps <2 x float> @wqm_f64(double %val) {
33 ; GCN-LABEL: name: wqm_f64
34 ; GCN: bb.1 (%ir-block.0):
35 ; GCN-NEXT: liveins: $vgpr0, $vgpr1
37 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
38 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
39 ; GCN-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[COPY1]], %subreg.sub1
40 ; GCN-NEXT: [[WQM:%[0-9]+]]:vreg_64 = WQM [[REG_SEQUENCE]], implicit $exec
41 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[WQM]].sub0
42 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[WQM]].sub1
43 ; GCN-NEXT: $vgpr0 = COPY [[COPY2]]
44 ; GCN-NEXT: $vgpr1 = COPY [[COPY3]]
45 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0, implicit $vgpr1
46 %ret = call double @llvm.amdgcn.wqm.f64(double %val)
47 %bitcast = bitcast double %ret to <2 x float>
48 ret <2 x float> %bitcast
52 ; define amdgpu_ps float @wqm_i1_vcc(float %val) {
53 ; %vcc = fcmp oeq float %val, 0.0
54 ; %ret = call i1 @llvm.amdgcn.wqm.i1(i1 %vcc)
55 ; %select = select i1 %ret, float 1.0, float 0.0
59 define amdgpu_ps <3 x float> @wqm_v3f32(<3 x float> %val) {
60 ; GCN-LABEL: name: wqm_v3f32
61 ; GCN: bb.1 (%ir-block.0):
62 ; GCN-NEXT: liveins: $vgpr0, $vgpr1, $vgpr2
64 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
65 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
66 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
67 ; GCN-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_96 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[COPY1]], %subreg.sub1, [[COPY2]], %subreg.sub2
68 ; GCN-NEXT: [[WQM:%[0-9]+]]:vreg_96 = WQM [[REG_SEQUENCE]], implicit $exec
69 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[WQM]].sub0
70 ; GCN-NEXT: [[COPY4:%[0-9]+]]:vgpr_32 = COPY [[WQM]].sub1
71 ; GCN-NEXT: [[COPY5:%[0-9]+]]:vgpr_32 = COPY [[WQM]].sub2
72 ; GCN-NEXT: $vgpr0 = COPY [[COPY3]]
73 ; GCN-NEXT: $vgpr1 = COPY [[COPY4]]
74 ; GCN-NEXT: $vgpr2 = COPY [[COPY5]]
75 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0, implicit $vgpr1, implicit $vgpr2
76 %ret = call <3 x float> @llvm.amdgcn.wqm.v3f32(<3 x float> %val)
80 declare i1 @llvm.amdgcn.wqm.i1(i1) #0
81 declare float @llvm.amdgcn.wqm.f32(float) #0
82 declare <2 x half> @llvm.amdgcn.wqm.v2f16(<2 x half>) #0
83 declare <3 x float> @llvm.amdgcn.wqm.v3f32(<3 x float>) #0
84 declare double @llvm.amdgcn.wqm.f64(double) #0
86 attributes #0 = { nounwind readnone speculatable }