1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=m68k < %s -o - | FileCheck %s
4 @g = internal global i32 10, align 4
6 ; This function is primarily testing constant constraints that can NOT
7 ; be easily checked by Clang. For example, 'K' and 'M' are both
8 ; constraints for values that are outside certain numerical range.
9 define void @constant_constraints() {
10 ; CHECK-LABEL: constant_constraints:
11 ; CHECK: .cfi_startproc
12 ; CHECK-NEXT: ; %bb.0: ; %entry
14 ; CHECK-NEXT: move.l #1, %d1
17 ; CHECK-NEXT: move.l #8, %d1
20 ; CHECK-NEXT: move.l #-32768, %d1
23 ; CHECK-NEXT: move.l #32767, %d1
26 ; CHECK-NEXT: move.l #-129, %d1
29 ; CHECK-NEXT: move.l #128, %d1
32 ; CHECK-NEXT: move.l #-8, %d1
35 ; CHECK-NEXT: move.l #-1, %d1
38 ; CHECK-NEXT: move.l #-257, %d1
41 ; CHECK-NEXT: move.l #256, %d1
44 ; CHECK-NEXT: move.l #24, %d1
47 ; CHECK-NEXT: move.l #31, %d1
50 ; CHECK-NEXT: move.l #16, %d1
53 ; CHECK-NEXT: move.l #8, %d1
56 ; CHECK-NEXT: move.l #15, %d1
59 ; CHECK-NEXT: move.l #0, %d1
62 ; CHECK-NEXT: move.l #1, %d1
65 ; CHECK-NEXT: move.l #-32769, %d1
68 ; CHECK-NEXT: move.l #32768, %d1
72 call void asm sideeffect "move.l $0, %d1", "I"(i32 1)
73 call void asm sideeffect "move.l $0, %d1", "I"(i32 8)
74 call void asm sideeffect "move.l $0, %d1", "J"(i32 -32768)
75 call void asm sideeffect "move.l $0, %d1", "J"(i32 32767)
76 call void asm sideeffect "move.l $0, %d1", "K"(i32 -129)
77 call void asm sideeffect "move.l $0, %d1", "K"(i32 128)
78 call void asm sideeffect "move.l $0, %d1", "L"(i32 -8)
79 call void asm sideeffect "move.l $0, %d1", "L"(i32 -1)
80 call void asm sideeffect "move.l $0, %d1", "M"(i32 -257)
81 call void asm sideeffect "move.l $0, %d1", "M"(i32 256)
82 call void asm sideeffect "move.l $0, %d1", "N"(i32 24)
83 call void asm sideeffect "move.l $0, %d1", "N"(i32 31)
84 call void asm sideeffect "move.l $0, %d1", "O"(i32 16)
85 call void asm sideeffect "move.l $0, %d1", "P"(i32 8)
86 call void asm sideeffect "move.l $0, %d1", "P"(i32 15)
87 call void asm sideeffect "move.l $0, %d1", "^C0"(i32 0)
88 call void asm sideeffect "move.l $0, %d1", "^Ci"(i32 1)
89 call void asm sideeffect "move.l $0, %d1", "^Cj"(i32 -32769)
90 call void asm sideeffect "move.l $0, %d1", "^Cj"(i32 32768)
94 define void @register_constraints() {
95 ; CHECK-LABEL: register_constraints:
96 ; CHECK: .cfi_startproc
97 ; CHECK-NEXT: ; %bb.0: ; %entry
98 ; CHECK-NEXT: suba.l #4, %sp
99 ; CHECK-NEXT: .cfi_def_cfa_offset -8
101 ; CHECK-NEXT: move.l #94, %d0
102 ; CHECK-NEXT: ;NO_APP
103 ; CHECK-NEXT: move.l %d0, (0,%sp)
105 ; CHECK-NEXT: move.l #87, %d0
106 ; CHECK-NEXT: ;NO_APP
107 ; CHECK-NEXT: move.l %d0, (0,%sp)
109 ; CHECK-NEXT: move.l #66, %a0
110 ; CHECK-NEXT: ;NO_APP
111 ; CHECK-NEXT: move.l %a0, (0,%sp)
112 ; CHECK-NEXT: adda.l #4, %sp
115 %out = alloca i32, align 4
116 %0 = call i32 asm sideeffect "move.l #94, $0", "=r"()
117 store i32 %0, i32* %out, align 4
118 %1 = call i32 asm sideeffect "move.l #87, $0", "=d"()
119 store i32 %1, i32* %out, align 4
120 %2 = call i32 asm sideeffect "move.l #66, $0", "=a"()
121 store i32 %2, i32* %out, align 4
125 define void @memory_constraints() {
126 ; CHECK-LABEL: memory_constraints:
127 ; CHECK: .cfi_startproc
128 ; CHECK-NEXT: ; %bb.0: ; %entry
129 ; CHECK-NEXT: suba.l #4, %sp
130 ; CHECK-NEXT: .cfi_def_cfa_offset -8
132 ; CHECK-NEXT: move.l (0,%sp), %d1
133 ; CHECK-NEXT: ;NO_APP
135 ; CHECK-NEXT: move.l (g,%pc), %d2
136 ; CHECK-NEXT: ;NO_APP
137 ; CHECK-NEXT: lea (0,%sp), %a0
139 ; CHECK-NEXT: move.l (%a0), %d3
140 ; CHECK-NEXT: ;NO_APP
142 ; CHECK-NEXT: move.l (0,%sp), %d4
143 ; CHECK-NEXT: ;NO_APP
144 ; CHECK-NEXT: adda.l #4, %sp
147 %x = alloca i32, align 4
148 call void asm sideeffect "move.l $0, %d1", "*m"(ptr elementtype(i32) %x)
149 call void asm sideeffect "move.l $0, %d2", "*m"(ptr elementtype(i32) @g)
150 call void asm sideeffect "move.l $0, %d3", "*Q"(ptr elementtype(i32) %x)
151 call void asm sideeffect "move.l $0, %d4", "*U"(ptr elementtype(i32) %x)