Skip to content

Commit 049630d

Browse files
[NFC][NVPTX][test] Update test for fneg half (llvm#95856)
`test_fneg` function uses `fsub half 0.0, %x`. Add a test that uses the `fneg` instruction directly.
1 parent e4b130f commit 049630d

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

llvm/test/CodeGen/NVPTX/f16-instructions.ll

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ define half @test_fsub(half %a, half %b) #0 {
131131
ret half %r
132132
}
133133

134-
; CHECK-LABEL: test_fneg(
135-
; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fneg_param_0];
134+
; CHECK-LABEL: test_old_fneg(
135+
; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_old_fneg_param_0];
136136
; CHECK-F16-NOFTZ-NEXT: mov.b16 [[Z:%rs[0-9]+]], 0x0000
137137
; CHECK-F16-NOFTZ-NEXT: sub.rn.f16 [[R:%rs[0-9]+]], [[Z]], [[A]];
138138
; CHECK-F16-FTZ-NEXT: mov.b16 [[Z:%rs[0-9]+]], 0x0000
@@ -143,11 +143,23 @@ define half @test_fsub(half %a, half %b) #0 {
143143
; CHECK-NOF16-NEXT: cvt.rn.f16.f32 [[R:%rs[0-9]+]], [[R32]]
144144
; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
145145
; CHECK-NEXT: ret;
146-
define half @test_fneg(half %a) #0 {
146+
define half @test_old_fneg(half %a) #0 {
147147
%r = fsub half 0.0, %a
148148
ret half %r
149149
}
150150

151+
; CHECK-LABEL: test_fneg(
152+
; CHECK: ld.param.b16 [[A:%rs[0-9]+]], [test_fneg_param_0];
153+
; CHECK-F16-NOFTZ-NEXT: neg.f16 [[R:%rs[0-9]+]], [[A]];
154+
; CHECK-F16-FTZ-NEXT: neg.ftz.f16 [[R:%rs[0-9]+]], [[A]];
155+
; CHECK-NOF16-NEXT: xor.b16 [[R:%rs[0-9]+]], [[A]], -32768;
156+
; CHECK-NEXT: st.param.b16 [func_retval0+0], [[R]];
157+
; CHECK-NEXT: ret;
158+
define half @test_fneg(half %a) #0 {
159+
%r = fneg half %a
160+
ret half %r
161+
}
162+
151163
; CHECK-LABEL: test_fmul(
152164
; CHECK-DAG: ld.param.b16 [[A:%rs[0-9]+]], [test_fmul_param_0];
153165
; CHECK-DAG: ld.param.b16 [[B:%rs[0-9]+]], [test_fmul_param_1];

0 commit comments

Comments
 (0)