Skip to content

Commit 89ff393

Browse files
committed
Add negative test for canonicalizing instructions. This test contains the specific instruction that was previously failing to apply the srcmod after eliding the bitmask instruction.
1 parent f8329c1 commit 89ff393

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 < %s | FileCheck -check-prefixes=GCN,GFX7 %s
3+
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,GFX9 %s
4+
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -mattr=+real-true16 < %s | FileCheck -check-prefixes=GFX11,GFX11-TRUE16 %s
5+
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -mattr=-real-true16 < %s | FileCheck -check-prefixes=GFX11,GFX11-FAKE16 %s
6+
7+
; Ensure that the conversion of bitmasks affecting the sign bit on integers to srcmods
8+
; does not apply to canonicalizing instructions.
9+
10+
define double @v_uitofp_i32_to_f64_abs(i32 %arg0) nounwind {
11+
; GCN-LABEL: v_uitofp_i32_to_f64_abs:
12+
; GCN: ; %bb.0:
13+
; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14+
; GCN-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0
15+
; GCN-NEXT: v_cvt_f64_u32_e32 v[0:1], v0
16+
; GCN-NEXT: s_setpc_b64 s[30:31]
17+
;
18+
; GFX11-LABEL: v_uitofp_i32_to_f64_abs:
19+
; GFX11: ; %bb.0:
20+
; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
21+
; GFX11-NEXT: v_and_b32_e32 v0, 0x7fffffff, v0
22+
; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
23+
; GFX11-NEXT: v_cvt_f64_u32_e32 v[0:1], v0
24+
; GFX11-NEXT: s_setpc_b64 s[30:31]
25+
%arg0.abs = and i32 %arg0, u0x7fffffff
26+
%cvt = uitofp i32 %arg0.abs to double
27+
ret double %cvt
28+
}
29+
30+
define double @v_uitofp_i32_to_f64_neg(i32 %arg0) nounwind {
31+
; GCN-LABEL: v_uitofp_i32_to_f64_neg:
32+
; GCN: ; %bb.0:
33+
; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
34+
; GCN-NEXT: v_and_b32_e32 v0, 0x80000000, v0
35+
; GCN-NEXT: v_cvt_f64_u32_e32 v[0:1], v0
36+
; GCN-NEXT: s_setpc_b64 s[30:31]
37+
;
38+
; GFX11-LABEL: v_uitofp_i32_to_f64_neg:
39+
; GFX11: ; %bb.0:
40+
; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
41+
; GFX11-NEXT: v_and_b32_e32 v0, 0x80000000, v0
42+
; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
43+
; GFX11-NEXT: v_cvt_f64_u32_e32 v[0:1], v0
44+
; GFX11-NEXT: s_setpc_b64 s[30:31]
45+
%arg0.neg = and i32 %arg0, u0x80000000
46+
%cvt = uitofp i32 %arg0.neg to double
47+
ret double %cvt
48+
}
49+
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
50+
; GFX11-FAKE16: {{.*}}
51+
; GFX11-TRUE16: {{.*}}
52+
; GFX7: {{.*}}
53+
; GFX9: {{.*}}

0 commit comments

Comments
 (0)