1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -march=hexagon < %s | FileCheck %s
4 ; Check that a store with a proper addressing mode is selected for various
5 ; cases of storing an immediate value.
7 @var_i8 = global [10 x i8] zeroinitializer, align 8
9 define void @store_imm_i8(ptr %p) nounwind {
10 ; CHECK-LABEL: store_imm_i8:
13 ; CHECK-NEXT: jumpr r31
14 ; CHECK-NEXT: memb(r0+#0) = #-1
16 store i8 255, ptr %p, align 4
20 define void @store_rr_i8(ptr %p, i32 %x) nounwind {
21 ; CHECK-LABEL: store_rr_i8:
24 ; CHECK-NEXT: r2 = #255
25 ; CHECK-NEXT: jumpr r31
26 ; CHECK-NEXT: memb(r0+r1<<#0) = r2.new
28 %t0 = getelementptr i8, ptr %p, i32 %x
29 store i8 255, ptr %t0, align 4
33 define void @store_io_i8(i32 %x) nounwind {
34 ; CHECK-LABEL: store_io_i8:
37 ; CHECK-NEXT: r1 = #255
38 ; CHECK-NEXT: jumpr r31
39 ; CHECK-NEXT: memb(r0+##var_i8) = r1.new
41 %t0 = getelementptr [10 x i8], ptr @var_i8, i32 0, i32 %x
42 store i8 255, ptr %t0, align 4
46 define void @store_ur_i8(i32 %x) nounwind {
47 ; CHECK-LABEL: store_ur_i8:
50 ; CHECK-NEXT: r1 = #255
51 ; CHECK-NEXT: jumpr r31
52 ; CHECK-NEXT: memb(r0<<#2+##var_i8) = r1.new
55 %t1 = getelementptr [10 x i8], ptr @var_i8, i32 0, i32 %t0
56 store i8 255, ptr %t1, align 4
60 @var_i16 = global [10 x i16] zeroinitializer, align 8
62 define void @store_imm_i16(ptr %p) nounwind {
63 ; CHECK-LABEL: store_imm_i16:
66 ; CHECK-NEXT: jumpr r31
67 ; CHECK-NEXT: memh(r0+#0) = #-1
69 store i16 65535, ptr %p, align 4
73 define void @store_rr_i16(ptr %p, i32 %x) nounwind {
74 ; CHECK-LABEL: store_rr_i16:
77 ; CHECK-NEXT: r2 = ##65535
78 ; CHECK-NEXT: jumpr r31
79 ; CHECK-NEXT: memh(r0+r1<<#1) = r2.new
81 %t0 = getelementptr i16, ptr %p, i32 %x
82 store i16 65535, ptr %t0, align 4
86 define void @store_ur_i16(i32 %x) nounwind {
87 ; CHECK-LABEL: store_ur_i16:
90 ; CHECK-NEXT: r1 = ##65535
91 ; CHECK-NEXT: memh(r0<<#1+##var_i16) = r1.new
94 ; CHECK-NEXT: jumpr r31
96 %t0 = getelementptr [10 x i16], ptr @var_i16, i32 0, i32 %x
97 store i16 65535, ptr %t0, align 4
101 @var_i32 = global [10 x i32] zeroinitializer, align 8
103 define void @store_imm_i32(ptr %p) nounwind {
104 ; CHECK-LABEL: store_imm_i32:
107 ; CHECK-NEXT: jumpr r31
108 ; CHECK-NEXT: memw(r0+#0) = #-1
110 store i32 4294967295, ptr %p, align 4
114 define void @store_rr_i32(ptr %p, i32 %x) nounwind {
115 ; CHECK-LABEL: store_rr_i32:
118 ; CHECK-NEXT: r2 = #-1
119 ; CHECK-NEXT: jumpr r31
120 ; CHECK-NEXT: memw(r0+r1<<#2) = r2.new
122 %t0 = getelementptr i32, ptr %p, i32 %x
123 store i32 4294967295, ptr %t0, align 4
127 define void @store_ur_i32(i32 %x) nounwind {
128 ; CHECK-LABEL: store_ur_i32:
131 ; CHECK-NEXT: r1 = #-1
132 ; CHECK-NEXT: jumpr r31
133 ; CHECK-NEXT: memw(r0<<#2+##var_i32) = r1.new
135 %t0 = getelementptr [10 x i32], ptr @var_i32, i32 0, i32 %x
136 store i32 4294967295, ptr %t0, align 4