1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
| ; RUN: llc -march=hexagon < %s | FileCheck %s
; Check that a store with a proper addressing mode is selected for various
; cases of storing an immediate value.
@var_i8 = global [10 x i8] zeroinitializer, align 8
; CHECK-LABEL: store_imm_i8:
; CHECK: memb(r0+#0) = #-1
define void @store_imm_i8(i8* %p) nounwind {
store i8 255, i8* %p, align 4
ret void
}
; CHECK-LABEL: store_rr_i8:
; CHECK: [[RV:r[0-9]+]] = #255
; CHECK: memb(r0+r1<<#0) = [[RV]]
define void @store_rr_i8(i8* %p, i32 %x) nounwind {
%t0 = getelementptr i8, i8* %p, i32 %x
store i8 255, i8* %t0, align 4
ret void
}
; CHECK-LABEL: store_io_i8:
; CHECK: [[RV:r[0-9]+]] = #255
; CHECK: memb(r0+##var_i8) = [[RV]]
define void @store_io_i8(i32 %x) nounwind {
%t0 = getelementptr [10 x i8], [10 x i8]* @var_i8, i32 0, i32 %x
store i8 255, i8* %t0, align 4
ret void
}
; CHECK-LABEL: store_ur_i8:
; CHECK: [[RV:r[0-9]+]] = #255
; CHECK: memb(r0<<#2+##var_i8) = [[RV]]
define void @store_ur_i8(i32 %x) nounwind {
%t0 = shl i32 %x, 2
%t1 = getelementptr [10 x i8], [10 x i8]* @var_i8, i32 0, i32 %t0
store i8 255, i8* %t1, align 4
ret void
}
@var_i16 = global [10 x i16] zeroinitializer, align 8
; CHECK-LABEL: store_imm_i16:
; CHECK: memh(r0+#0) = #-1
define void @store_imm_i16(i16* %p) nounwind {
store i16 65535, i16* %p, align 4
ret void
}
; CHECK-LABEL: store_rr_i16:
; CHECK: [[RV:r[0-9]+]] = ##65535
; CHECK: memh(r0+r1<<#1) = [[RV]]
define void @store_rr_i16(i16* %p, i32 %x) nounwind {
%t0 = getelementptr i16, i16* %p, i32 %x
store i16 65535, i16* %t0, align 4
ret void
}
; CHECK-LABEL: store_ur_i16:
; CHECK: [[RV:r[0-9]+]] = ##65535
; CHECK: memh(r0<<#1+##var_i16) = [[RV]]
define void @store_ur_i16(i32 %x) nounwind {
%t0 = getelementptr [10 x i16], [10 x i16]* @var_i16, i32 0, i32 %x
store i16 65535, i16* %t0, align 4
ret void
}
@var_i32 = global [10 x i32] zeroinitializer, align 8
; CHECK-LABEL: store_imm_i32:
; CHECK: memw(r0+#0) = #-1
define void @store_imm_i32(i32* %p) nounwind {
store i32 4294967295, i32* %p, align 4
ret void
}
; CHECK-LABEL: store_rr_i32:
; CHECK: [[RV:r[0-9]+]] = #-1
; CHECK: memw(r0+r1<<#2) = [[RV]]
define void @store_rr_i32(i32* %p, i32 %x) nounwind {
%t0 = getelementptr i32, i32* %p, i32 %x
store i32 4294967295, i32* %t0, align 4
ret void
}
; CHECK-LABEL: store_ur_i32:
; CHECK: [[RV:r[0-9]+]] = #-1
; CHECK: memw(r0<<#2+##var_i32) = [[RV]]
define void @store_ur_i32(i32 %x) nounwind {
%t0 = getelementptr [10 x i32], [10 x i32]* @var_i32, i32 0, i32 %x
store i32 4294967295, i32* %t0, align 4
ret void
}
|