1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=gfx900 -mattr=+fp32-denormals,+fp64-fp16-denormals -run-pass=instruction-select -global-isel-abort=2 -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX9-DENORM %s
3 # RUN: llc -march=amdgcn -mcpu=gfx900 -mattr=-fp32-denormals,-fp64-fp16-denormals -run-pass=instruction-select -global-isel-abort=2 -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX9-FLUSH %s
7 name: fcanonicalize_f16
14 ; GFX9-DENORM-LABEL: name: fcanonicalize_f16
15 ; GFX9-DENORM: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
16 ; GFX9-DENORM: [[V_MAX_F16_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F16_e64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $exec
17 ; GFX9-DENORM: S_ENDPGM 0, implicit [[V_MAX_F16_e64_]]
18 ; GFX9-FLUSH-LABEL: name: fcanonicalize_f16
19 ; GFX9-FLUSH: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
20 ; GFX9-FLUSH: [[V_MUL_F16_e64_:%[0-9]+]]:vgpr_32 = V_MUL_F16_e64 0, 15360, 0, [[COPY]], 0, 0, implicit $exec
21 ; GFX9-FLUSH: S_ENDPGM 0, implicit [[V_MUL_F16_e64_]]
22 %0:vgpr(s32) = COPY $vgpr0
23 %1:vgpr(s16) = G_TRUNC %0
24 %2:vgpr(s16) = G_FCANONICALIZE %1
25 S_ENDPGM 0, implicit %2
30 name: fcanonicalize_f32
37 ; GFX9-DENORM-LABEL: name: fcanonicalize_f32
38 ; GFX9-DENORM: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
39 ; GFX9-DENORM: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $exec
40 ; GFX9-DENORM: S_ENDPGM 0, implicit [[V_MAX_F32_e64_]]
41 ; GFX9-FLUSH-LABEL: name: fcanonicalize_f32
42 ; GFX9-FLUSH: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
43 ; GFX9-FLUSH: [[V_MUL_F32_e64_:%[0-9]+]]:vgpr_32 = V_MUL_F32_e64 0, 1065353216, 0, [[COPY]], 0, 0, implicit $exec
44 ; GFX9-FLUSH: S_ENDPGM 0, implicit [[V_MUL_F32_e64_]]
45 %0:vgpr(s32) = COPY $vgpr0
46 %1:vgpr(s32) = G_FCANONICALIZE %0
47 S_ENDPGM 0, implicit %1
52 name: fcanonicalize_v2f16
59 ; GFX9-DENORM-LABEL: name: fcanonicalize_v2f16
60 ; GFX9-DENORM: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
61 ; GFX9-DENORM: [[FCANONICALIZE:%[0-9]+]]:vgpr(<2 x s16>) = G_FCANONICALIZE [[COPY]]
62 ; GFX9-DENORM: S_ENDPGM 0, implicit [[FCANONICALIZE]](<2 x s16>)
63 ; GFX9-FLUSH-LABEL: name: fcanonicalize_v2f16
64 ; GFX9-FLUSH: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
65 ; GFX9-FLUSH: [[FCANONICALIZE:%[0-9]+]]:vgpr(<2 x s16>) = G_FCANONICALIZE [[COPY]]
66 ; GFX9-FLUSH: S_ENDPGM 0, implicit [[FCANONICALIZE]](<2 x s16>)
67 %0:vgpr(<2 x s16>) = COPY $vgpr0
68 %1:vgpr(<2 x s16>) = G_FCANONICALIZE %0
69 S_ENDPGM 0, implicit %1
74 name: fcanonicalize_f64
81 ; GFX9-DENORM-LABEL: name: fcanonicalize_f64
82 ; GFX9-DENORM: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
83 ; GFX9-DENORM: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $exec
84 ; GFX9-DENORM: S_ENDPGM 0, implicit [[V_MAX_F64_]]
85 ; GFX9-FLUSH-LABEL: name: fcanonicalize_f64
86 ; GFX9-FLUSH: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
87 ; GFX9-FLUSH: [[V_MUL_F64_:%[0-9]+]]:vreg_64 = V_MUL_F64 0, 4607182418800017408, 0, [[COPY]], 0, 0, implicit $exec
88 ; GFX9-FLUSH: S_ENDPGM 0, implicit [[V_MUL_F64_]]
89 %0:vgpr(s64) = COPY $vgpr0_vgpr1
90 %1:vgpr(s64) = G_FCANONICALIZE %0
91 S_ENDPGM 0, implicit %1
96 name: fcanonicalize_fabs_f32
103 ; GFX9-DENORM-LABEL: name: fcanonicalize_fabs_f32
104 ; GFX9-DENORM: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
105 ; GFX9-DENORM: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 2, [[COPY]], 2, [[COPY]], 0, 0, implicit $exec
106 ; GFX9-DENORM: S_ENDPGM 0, implicit [[V_MAX_F32_e64_]]
107 ; GFX9-FLUSH-LABEL: name: fcanonicalize_fabs_f32
108 ; GFX9-FLUSH: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
109 ; GFX9-FLUSH: [[V_MUL_F32_e64_:%[0-9]+]]:vgpr_32 = V_MUL_F32_e64 0, 1065353216, 2, [[COPY]], 0, 0, implicit $exec
110 ; GFX9-FLUSH: S_ENDPGM 0, implicit [[V_MUL_F32_e64_]]
111 %0:vgpr(s32) = COPY $vgpr0
112 %1:vgpr(s32) = G_FABS %0
113 %2:vgpr(s32) = G_FCANONICALIZE %1
114 S_ENDPGM 0, implicit %2
119 name: fcanonicalize_fneg_f32
121 regBankSelected: true
126 ; GFX9-DENORM-LABEL: name: fcanonicalize_fneg_f32
127 ; GFX9-DENORM: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
128 ; GFX9-DENORM: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 1, [[COPY]], 1, [[COPY]], 0, 0, implicit $exec
129 ; GFX9-DENORM: S_ENDPGM 0, implicit [[V_MAX_F32_e64_]]
130 ; GFX9-FLUSH-LABEL: name: fcanonicalize_fneg_f32
131 ; GFX9-FLUSH: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
132 ; GFX9-FLUSH: [[V_MUL_F32_e64_:%[0-9]+]]:vgpr_32 = V_MUL_F32_e64 0, 3212836864, 0, [[COPY]], 0, 0, implicit $exec
133 ; GFX9-FLUSH: S_ENDPGM 0, implicit [[V_MUL_F32_e64_]]
134 %0:vgpr(s32) = COPY $vgpr0
135 %1:vgpr(s32) = G_FNEG %0
136 %2:vgpr(s32) = G_FCANONICALIZE %1
137 S_ENDPGM 0, implicit %2
142 name: fcanonicalize_fneg_fabs_f32
144 regBankSelected: true
149 ; GFX9-DENORM-LABEL: name: fcanonicalize_fneg_fabs_f32
150 ; GFX9-DENORM: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
151 ; GFX9-DENORM: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
152 ; GFX9-DENORM: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec
153 ; GFX9-DENORM: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 2, [[V_XOR_B32_e32_]], 2, [[V_XOR_B32_e32_]], 0, 0, implicit $exec
154 ; GFX9-DENORM: S_ENDPGM 0, implicit [[V_MAX_F32_e64_]]
155 ; GFX9-FLUSH-LABEL: name: fcanonicalize_fneg_fabs_f32
156 ; GFX9-FLUSH: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
157 ; GFX9-FLUSH: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
158 ; GFX9-FLUSH: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec
159 ; GFX9-FLUSH: [[V_MUL_F32_e64_:%[0-9]+]]:vgpr_32 = V_MUL_F32_e64 0, 1065353216, 2, [[V_XOR_B32_e32_]], 0, 0, implicit $exec
160 ; GFX9-FLUSH: S_ENDPGM 0, implicit [[V_MUL_F32_e64_]]
161 %0:vgpr(s32) = COPY $vgpr0
162 %1:vgpr(s32) = G_FNEG %0
163 %2:vgpr(s32) = G_FABS %1
164 %3:vgpr(s32) = G_FCANONICALIZE %2
165 S_ENDPGM 0, implicit %3