1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=gfx1010 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
5 name: rcp_sqrt_test_f32
10 ; GCN-LABEL: name: rcp_sqrt_test_f32
11 ; GCN: liveins: $sgpr0
13 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
14 ; GCN-NEXT: [[FSQRT:%[0-9]+]]:_(s32) = G_FSQRT [[COPY]]
15 ; GCN-NEXT: [[INT:%[0-9]+]]:_(s32) = afn G_INTRINSIC intrinsic(@llvm.amdgcn.rcp), [[FSQRT]](s32)
16 ; GCN-NEXT: $vgpr0 = COPY [[INT]](s32)
17 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0
18 %0:_(s32) = COPY $sgpr0
19 %2:_(s32) = G_FSQRT %0:_
20 %3:_(s32) = afn G_INTRINSIC intrinsic(@llvm.amdgcn.rcp), %2:_(s32)
21 $vgpr0 = COPY %3:_(s32)
22 SI_RETURN_TO_EPILOG implicit $vgpr0
27 name: contract_afn_rcp_contract_sqrt_test_f32
32 ; GCN-LABEL: name: contract_afn_rcp_contract_sqrt_test_f32
33 ; GCN: liveins: $sgpr0
35 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
36 ; GCN-NEXT: [[INT:%[0-9]+]]:_(s32) = contract afn G_INTRINSIC intrinsic(@llvm.amdgcn.rsq), [[COPY]](s32)
37 ; GCN-NEXT: $vgpr0 = COPY [[INT]](s32)
38 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0
39 %0:_(s32) = COPY $sgpr0
40 %2:_(s32) = contract G_FSQRT %0:_
41 %3:_(s32) = contract afn G_INTRINSIC intrinsic(@llvm.amdgcn.rcp), %2:_(s32)
42 $vgpr0 = COPY %3:_(s32)
43 SI_RETURN_TO_EPILOG implicit $vgpr0
48 name: sqrt_rcp_test_f32
53 ; GCN-LABEL: name: sqrt_rcp_test_f32
54 ; GCN: liveins: $sgpr0
56 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
57 ; GCN-NEXT: [[INT:%[0-9]+]]:_(s32) = afn G_INTRINSIC intrinsic(@llvm.amdgcn.rcp), [[COPY]](s32)
58 ; GCN-NEXT: [[FSQRT:%[0-9]+]]:_(s32) = G_FSQRT [[INT]]
59 ; GCN-NEXT: $vgpr0 = COPY [[FSQRT]](s32)
60 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0
61 %0:_(s32) = COPY $sgpr0
62 %2:_(s32) = afn G_INTRINSIC intrinsic(@llvm.amdgcn.rcp), %0:_(s32)
63 %3:_(s32) = G_FSQRT %2:_
64 $vgpr0 = COPY %3:_(s32)
65 SI_RETURN_TO_EPILOG implicit $vgpr0
70 name: afn_rcp_afn_amdgcn_sqrt_test_f32
75 ; GCN-LABEL: name: afn_rcp_afn_amdgcn_sqrt_test_f32
76 ; GCN: liveins: $sgpr0
78 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
79 ; GCN-NEXT: [[INT:%[0-9]+]]:_(s32) = afn G_INTRINSIC intrinsic(@llvm.amdgcn.sqrt), [[COPY]](s32)
80 ; GCN-NEXT: [[INT1:%[0-9]+]]:_(s32) = afn G_INTRINSIC intrinsic(@llvm.amdgcn.rcp), [[INT]](s32)
81 ; GCN-NEXT: $vgpr0 = COPY [[INT1]](s32)
82 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0
83 %0:_(s32) = COPY $sgpr0
84 %1:_(s32) = afn G_INTRINSIC intrinsic(@llvm.amdgcn.sqrt), %0:_(s32)
85 %2:_(s32) = afn G_INTRINSIC intrinsic(@llvm.amdgcn.rcp), %1:_(s32)
87 SI_RETURN_TO_EPILOG implicit $vgpr0
92 name: afn_contract_rcp_afn_contract_amdgcn_sqrt_test_f32
97 ; GCN-LABEL: name: afn_contract_rcp_afn_contract_amdgcn_sqrt_test_f32
98 ; GCN: liveins: $sgpr0
100 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
101 ; GCN-NEXT: [[INT:%[0-9]+]]:_(s32) = contract afn G_INTRINSIC intrinsic(@llvm.amdgcn.sqrt), [[COPY]](s32)
102 ; GCN-NEXT: [[INT1:%[0-9]+]]:_(s32) = contract afn G_INTRINSIC intrinsic(@llvm.amdgcn.rcp), [[INT]](s32)
103 ; GCN-NEXT: $vgpr0 = COPY [[INT1]](s32)
104 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0
105 %0:_(s32) = COPY $sgpr0
106 %1:_(s32) = afn contract G_INTRINSIC intrinsic(@llvm.amdgcn.sqrt), %0:_(s32)
107 %2:_(s32) = afn contract G_INTRINSIC intrinsic(@llvm.amdgcn.rcp), %1:_(s32)
109 SI_RETURN_TO_EPILOG implicit $vgpr0
119 ; GCN-LABEL: name: rsq_test_f16
120 ; GCN: liveins: $sgpr0
122 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
123 ; GCN-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
124 ; GCN-NEXT: %sqrt:_(s16) = G_FSQRT [[TRUNC]]
125 ; GCN-NEXT: %one:_(s16) = contract G_FCONSTANT half 0xH3C00
126 ; GCN-NEXT: %rsq:_(s16) = contract G_FDIV %one, %sqrt
127 ; GCN-NEXT: %ext:_(s32) = G_ANYEXT %rsq(s16)
128 ; GCN-NEXT: $vgpr0 = COPY %ext(s32)
129 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0
130 %0:_(s32) = COPY $sgpr0
131 %1:_(s16) = G_TRUNC %0
132 %sqrt:_(s16) = G_FSQRT %1:_
133 %one:_(s16) = contract G_FCONSTANT half 1.0
134 %rsq:_(s16) = contract G_FDIV %one, %sqrt
135 %ext:_(s32) = G_ANYEXT %rsq
137 SI_RETURN_TO_EPILOG implicit $vgpr0
142 name: neg_rsq_test_f16
147 ; GCN-LABEL: name: neg_rsq_test_f16
148 ; GCN: liveins: $sgpr0
150 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
151 ; GCN-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
152 ; GCN-NEXT: %sqrt:_(s16) = G_FSQRT [[TRUNC]]
153 ; GCN-NEXT: %one:_(s16) = contract G_FCONSTANT half 0xHBC00
154 ; GCN-NEXT: %rsq:_(s16) = contract G_FDIV %one, %sqrt
155 ; GCN-NEXT: %ext:_(s32) = G_ANYEXT %rsq(s16)
156 ; GCN-NEXT: $vgpr0 = COPY %ext(s32)
157 ; GCN-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0
158 %0:_(s32) = COPY $sgpr0
159 %1:_(s16) = G_TRUNC %0
160 %sqrt:_(s16) = G_FSQRT %1:_
161 %one:_(s16) = contract G_FCONSTANT half -1.0
162 %rsq:_(s16) = contract G_FDIV %one, %sqrt
163 %ext:_(s32) = G_ANYEXT %rsq
165 SI_RETURN_TO_EPILOG implicit $vgpr0