1 ; RUN: llc -march=hexagon < %s | FileCheck %s
3 ; Check that a store with a proper addressing mode is selected for various
4 ; cases of storing an immediate value.
7 @var_i8 = global [10 x i8] zeroinitializer, align 8
9 ; CHECK-LABEL: store_imm_i8:
10 ; CHECK: memb(r0+#0) = #-1
11 define void @store_imm_i8(i8* %p) nounwind {
12 store i8 255, i8* %p, align 4
16 ; CHECK-LABEL: store_rr_i8:
17 ; CHECK: [[RV:r[0-9]+]] = #255
18 ; CHECK: memb(r0+r1<<#0) = [[RV]]
19 define void @store_rr_i8(i8* %p, i32 %x) nounwind {
20 %t0 = getelementptr i8, i8* %p, i32 %x
21 store i8 255, i8* %t0, align 4
25 ; CHECK-LABEL: store_io_i8:
26 ; CHECK: [[RV:r[0-9]+]] = #255
27 ; CHECK: memb(r0+##var_i8) = [[RV]]
28 define void @store_io_i8(i32 %x) nounwind {
29 %t0 = getelementptr [10 x i8], [10 x i8]* @var_i8, i32 0, i32 %x
30 store i8 255, i8* %t0, align 4
34 ; CHECK-LABEL: store_ur_i8:
35 ; CHECK: [[RV:r[0-9]+]] = #255
36 ; CHECK: memb(r0<<#2+##var_i8) = [[RV]]
37 define void @store_ur_i8(i32 %x) nounwind {
39 %t1 = getelementptr [10 x i8], [10 x i8]* @var_i8, i32 0, i32 %t0
40 store i8 255, i8* %t1, align 4
44 @var_i16 = global [10 x i16] zeroinitializer, align 8
46 ; CHECK-LABEL: store_imm_i16:
47 ; CHECK: memh(r0+#0) = #-1
48 define void @store_imm_i16(i16* %p) nounwind {
49 store i16 65535, i16* %p, align 4
53 ; CHECK-LABEL: store_rr_i16:
54 ; CHECK: [[RV:r[0-9]+]] = ##65535
55 ; CHECK: memh(r0+r1<<#1) = [[RV]]
56 define void @store_rr_i16(i16* %p, i32 %x) nounwind {
57 %t0 = getelementptr i16, i16* %p, i32 %x
58 store i16 65535, i16* %t0, align 4
62 ; CHECK-LABEL: store_ur_i16:
63 ; CHECK: [[RV:r[0-9]+]] = ##65535
64 ; CHECK: memh(r0<<#1+##var_i16) = [[RV]]
65 define void @store_ur_i16(i32 %x) nounwind {
66 %t0 = getelementptr [10 x i16], [10 x i16]* @var_i16, i32 0, i32 %x
67 store i16 65535, i16* %t0, align 4
71 @var_i32 = global [10 x i32] zeroinitializer, align 8
73 ; CHECK-LABEL: store_imm_i32:
74 ; CHECK: memw(r0+#0) = #-1
75 define void @store_imm_i32(i32* %p) nounwind {
76 store i32 4294967295, i32* %p, align 4
80 ; CHECK-LABEL: store_rr_i32:
81 ; CHECK: [[RV:r[0-9]+]] = #-1
82 ; CHECK: memw(r0+r1<<#2) = [[RV]]
83 define void @store_rr_i32(i32* %p, i32 %x) nounwind {
84 %t0 = getelementptr i32, i32* %p, i32 %x
85 store i32 4294967295, i32* %t0, align 4
89 ; CHECK-LABEL: store_ur_i32:
90 ; CHECK: [[RV:r[0-9]+]] = #-1
91 ; CHECK: memw(r0<<#2+##var_i32) = [[RV]]
92 define void @store_ur_i32(i32 %x) nounwind {
93 %t0 = getelementptr [10 x i32], [10 x i32]* @var_i32, i32 0, i32 %x
94 store i32 4294967295, i32* %t0, align 4