1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN %s
4 define i32 @range_metadata_sext_i8_signed_range_i32(ptr addrspace(1) %ptr) {
5 ; GCN-LABEL: range_metadata_sext_i8_signed_range_i32:
7 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8 ; GCN-NEXT: global_load_dword v0, v[0:1], off glc
9 ; GCN-NEXT: s_waitcnt vmcnt(0)
10 ; GCN-NEXT: s_setpc_b64 s[30:31]
11 %val = load volatile i32, ptr addrspace(1) %ptr, align 4, !range !0, !noundef !{} ; [-127, 128)
12 %shl = shl i32 %val, 24
13 %ashr = ashr i32 %shl, 24
17 define i32 @range_metadata_sext_upper_range_limited_i32(ptr addrspace(1) %ptr) {
18 ; GCN-LABEL: range_metadata_sext_upper_range_limited_i32:
20 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
21 ; GCN-NEXT: global_load_dword v0, v[0:1], off glc
22 ; GCN-NEXT: s_waitcnt vmcnt(0)
23 ; GCN-NEXT: v_bfe_i32 v0, v0, 0, 8
24 ; GCN-NEXT: s_setpc_b64 s[30:31]
25 %val = load volatile i32, ptr addrspace(1) %ptr, align 4, !range !1, !noundef !{} ; [-127, 256)
26 %shl = shl i32 %val, 24
27 %ashr = ashr i32 %shl, 24
31 define i32 @range_metadata_sext_lower_range_limited_i32(ptr addrspace(1) %ptr) {
32 ; GCN-LABEL: range_metadata_sext_lower_range_limited_i32:
34 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
35 ; GCN-NEXT: global_load_dword v0, v[0:1], off glc
36 ; GCN-NEXT: s_waitcnt vmcnt(0)
37 ; GCN-NEXT: v_bfe_i32 v0, v0, 0, 8
38 ; GCN-NEXT: s_setpc_b64 s[30:31]
39 %val = load volatile i32, ptr addrspace(1) %ptr, align 4, !range !2 ; [-255, 128)
40 %shl = shl i32 %val, 24
41 %ashr = ashr i32 %shl, 24
45 define i32 @range_metadata_sext_i8_neg_neg_range_i32(ptr addrspace(1) %ptr) {
46 ; GCN-LABEL: range_metadata_sext_i8_neg_neg_range_i32:
48 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
49 ; GCN-NEXT: global_load_dword v0, v[0:1], off glc
50 ; GCN-NEXT: s_waitcnt vmcnt(0)
51 ; GCN-NEXT: v_and_b32_e32 v0, 63, v0
52 ; GCN-NEXT: s_setpc_b64 s[30:31]
53 %val = load volatile i32, ptr addrspace(1) %ptr, align 4, !range !3, !noundef !{}
54 %shl = shl i32 %val, 25
55 %ashr = ashr i32 %shl, 25
59 define i32 @range_metadata_sextload_i8_signed_range_i4_i32(ptr addrspace(1) %ptr) {
60 ; GCN-LABEL: range_metadata_sextload_i8_signed_range_i4_i32:
62 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
63 ; GCN-NEXT: global_load_sbyte v0, v[0:1], off glc
64 ; GCN-NEXT: s_waitcnt vmcnt(0)
65 ; GCN-NEXT: s_setpc_b64 s[30:31]
66 %load = load volatile i8, ptr addrspace(1) %ptr, align 1, !range !4, !noundef !{}
67 %shl = shl i8 %load, 3
68 %ashr = ashr i8 %shl, 3
69 %ext = sext i8 %ashr to i32
73 define i25 @range_metadata_sext_i8_signed_range_i25(ptr addrspace(1) %ptr) {
74 ; GCN-LABEL: range_metadata_sext_i8_signed_range_i25:
76 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
77 ; GCN-NEXT: global_load_dword v0, v[0:1], off glc
78 ; GCN-NEXT: s_waitcnt vmcnt(0)
79 ; GCN-NEXT: v_bfe_i32 v0, v0, 0, 2
80 ; GCN-NEXT: s_setpc_b64 s[30:31]
81 %val = load volatile i25, ptr addrspace(1) %ptr, align 4, !range !5, !noundef !{}
82 %shl = shl i25 %val, 23
83 %ashr = ashr i25 %shl, 23
87 define i32 @range_metadata_i32_neg1_to_1(ptr addrspace(1) %ptr) {
88 ; GCN-LABEL: range_metadata_i32_neg1_to_1:
90 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
91 ; GCN-NEXT: global_load_dword v0, v[0:1], off glc
92 ; GCN-NEXT: s_waitcnt vmcnt(0)
93 ; GCN-NEXT: s_setpc_b64 s[30:31]
94 %val = load volatile i32, ptr addrspace(1) %ptr, align 4, !range !6, !noundef !{}
95 %shl = shl i32 %val, 31
96 %ashr = ashr i32 %shl, 31
100 define i64 @range_metadata_sext_i8_signed_range_i64(ptr addrspace(1) %ptr) {
101 ; GCN-LABEL: range_metadata_sext_i8_signed_range_i64:
103 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
104 ; GCN-NEXT: global_load_dwordx2 v[0:1], v[0:1], off glc
105 ; GCN-NEXT: s_waitcnt vmcnt(0)
106 ; GCN-NEXT: v_lshlrev_b32_e32 v1, 23, v0
107 ; GCN-NEXT: v_ashrrev_i64 v[0:1], 55, v[0:1]
108 ; GCN-NEXT: s_setpc_b64 s[30:31]
109 %val = load volatile i64, ptr addrspace(1) %ptr, align 4, !range !7, !noundef !{}
110 %shl = shl i64 %val, 55
111 %ashr = ashr i64 %shl, 55
115 define i64 @range_metadata_sext_i32_signed_range_i64(ptr addrspace(1) %ptr) {
116 ; GCN-LABEL: range_metadata_sext_i32_signed_range_i64:
118 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
119 ; GCN-NEXT: global_load_dwordx2 v[0:1], v[0:1], off glc
120 ; GCN-NEXT: s_waitcnt vmcnt(0)
121 ; GCN-NEXT: s_setpc_b64 s[30:31]
122 %val = load volatile i64, ptr addrspace(1) %ptr, align 4, !range !7, !noundef !{}
123 %shl = shl i64 %val, 31
124 %ashr = ashr i64 %shl, 31
128 define i64 @range_metadata_sext_i33_signed_range_i64(ptr addrspace(1) %ptr) {
129 ; GCN-LABEL: range_metadata_sext_i33_signed_range_i64:
131 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
132 ; GCN-NEXT: global_load_dwordx2 v[0:1], v[0:1], off glc
133 ; GCN-NEXT: s_waitcnt vmcnt(0)
134 ; GCN-NEXT: s_setpc_b64 s[30:31]
135 %val = load volatile i64, ptr addrspace(1) %ptr, align 4, !range !8, !noundef !{}
136 %shl = shl i64 %val, 30
137 %ashr = ashr i64 %shl, 30
141 !0 = !{i32 -127, i32 128}
142 !1 = !{i32 -127, i32 256}
143 !2 = !{i32 -255, i32 128}
144 !3 = !{i32 -127, i32 -64}
145 !4 = !{i8 -15, i8 16}
146 !5 = !{i25 -127, i25 128}
147 !6 = !{i32 -1, i32 1}
148 !7 = !{i64 -4294967295, i64 4294967296}
149 !8 = !{i64 -8589934591, i64 8589934592}