1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck %s
4 define i64 @and1(i64 %x) {
7 ; CHECK-NEXT: movabsq $-2147483649, %rax # imm = 0xFFFFFFFF7FFFFFFF
8 ; CHECK-NEXT: andq %rdi, %rax
10 %a = and i64 %x, 18446744071562067967 ; clear bit 31
14 define i64 @and2(i64 %x) {
17 ; CHECK-NEXT: movabsq $-4294967297, %rax # imm = 0xFFFFFFFEFFFFFFFF
18 ; CHECK-NEXT: andq %rdi, %rax
20 %a = and i64 %x, 18446744069414584319 ; clear bit 32
24 define i64 @and3(i64 %x) {
27 ; CHECK-NEXT: movabsq $-4611686018427387905, %rax # imm = 0xBFFFFFFFFFFFFFFF
28 ; CHECK-NEXT: andq %rdi, %rax
30 %a = and i64 %x, 13835058055282163711 ; clear bit 62
34 define i64 @and4(i64 %x) {
37 ; CHECK-NEXT: movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF
38 ; CHECK-NEXT: andq %rdi, %rax
40 %a = and i64 %x, 9223372036854775807 ; clear bit 63
44 define i64 @or1(i64 %x) {
47 ; CHECK-NEXT: movl $2147483648, %eax # imm = 0x80000000
48 ; CHECK-NEXT: orq %rdi, %rax
50 %a = or i64 %x, 2147483648 ; set bit 31
54 define i64 @or2(i64 %x) {
57 ; CHECK-NEXT: movabsq $4294967296, %rax # imm = 0x100000000
58 ; CHECK-NEXT: orq %rdi, %rax
60 %a = or i64 %x, 4294967296 ; set bit 32
64 define i64 @or3(i64 %x) {
67 ; CHECK-NEXT: movabsq $4611686018427387904, %rax # imm = 0x4000000000000000
68 ; CHECK-NEXT: orq %rdi, %rax
70 %a = or i64 %x, 4611686018427387904 ; set bit 62
74 define i64 @or4(i64 %x) {
77 ; CHECK-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000
78 ; CHECK-NEXT: orq %rdi, %rax
80 %a = or i64 %x, 9223372036854775808 ; set bit 63
84 define i64 @xor1(i64 %x) {
87 ; CHECK-NEXT: movl $2147483648, %eax # imm = 0x80000000
88 ; CHECK-NEXT: xorq %rdi, %rax
90 %a = xor i64 %x, 2147483648 ; toggle bit 31
94 define i64 @xor2(i64 %x) {
97 ; CHECK-NEXT: movabsq $4294967296, %rax # imm = 0x100000000
98 ; CHECK-NEXT: xorq %rdi, %rax
100 %a = xor i64 %x, 4294967296 ; toggle bit 32
104 define i64 @xor3(i64 %x) {
107 ; CHECK-NEXT: movabsq $4611686018427387904, %rax # imm = 0x4000000000000000
108 ; CHECK-NEXT: xorq %rdi, %rax
110 %a = xor i64 %x, 4611686018427387904 ; toggle bit 62
114 define i64 @xor4(i64 %x) {
117 ; CHECK-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000
118 ; CHECK-NEXT: xorq %rdi, %rax
120 %a = xor i64 %x, 9223372036854775808 ; toggle bit 63
124 define i64 @and1_optsize(i64 %x) optsize {
125 ; CHECK-LABEL: and1_optsize:
127 ; CHECK-NEXT: movq %rdi, %rax
128 ; CHECK-NEXT: btrq $31, %rax
130 %a = and i64 %x, 18446744071562067967 ; clear bit 31
134 define i64 @and2_optsize(i64 %x) optsize {
135 ; CHECK-LABEL: and2_optsize:
137 ; CHECK-NEXT: movq %rdi, %rax
138 ; CHECK-NEXT: btrq $32, %rax
140 %a = and i64 %x, 18446744069414584319 ; clear bit 32
144 define i64 @and3_optsize(i64 %x) optsize {
145 ; CHECK-LABEL: and3_optsize:
147 ; CHECK-NEXT: movq %rdi, %rax
148 ; CHECK-NEXT: btrq $62, %rax
150 %a = and i64 %x, 13835058055282163711 ; clear bit 62
154 define i64 @and4_optsize(i64 %x) optsize {
155 ; CHECK-LABEL: and4_optsize:
157 ; CHECK-NEXT: movq %rdi, %rax
158 ; CHECK-NEXT: btrq $63, %rax
160 %a = and i64 %x, 9223372036854775807 ; clear bit 63
164 define i64 @or1_optsize(i64 %x) optsize {
165 ; CHECK-LABEL: or1_optsize:
167 ; CHECK-NEXT: movq %rdi, %rax
168 ; CHECK-NEXT: btsq $31, %rax
170 %a = or i64 %x, 2147483648 ; set bit 31
174 define i64 @or2_optsize(i64 %x) optsize {
175 ; CHECK-LABEL: or2_optsize:
177 ; CHECK-NEXT: movq %rdi, %rax
178 ; CHECK-NEXT: btsq $32, %rax
180 %a = or i64 %x, 4294967296 ; set bit 32
184 define i64 @or3_optsize(i64 %x) optsize {
185 ; CHECK-LABEL: or3_optsize:
187 ; CHECK-NEXT: movq %rdi, %rax
188 ; CHECK-NEXT: btsq $62, %rax
190 %a = or i64 %x, 4611686018427387904 ; set bit 62
194 define i64 @or4_optsize(i64 %x) optsize {
195 ; CHECK-LABEL: or4_optsize:
197 ; CHECK-NEXT: movq %rdi, %rax
198 ; CHECK-NEXT: btsq $63, %rax
200 %a = or i64 %x, 9223372036854775808 ; set bit 63
204 define i64 @xor1_optsize(i64 %x) optsize {
205 ; CHECK-LABEL: xor1_optsize:
207 ; CHECK-NEXT: movq %rdi, %rax
208 ; CHECK-NEXT: btcq $31, %rax
210 %a = xor i64 %x, 2147483648 ; toggle bit 31
214 define i64 @xor2_optsize(i64 %x) optsize {
215 ; CHECK-LABEL: xor2_optsize:
217 ; CHECK-NEXT: movq %rdi, %rax
218 ; CHECK-NEXT: btcq $32, %rax
220 %a = xor i64 %x, 4294967296 ; toggle bit 32
224 define i64 @xor3_optsize(i64 %x) optsize {
225 ; CHECK-LABEL: xor3_optsize:
227 ; CHECK-NEXT: movq %rdi, %rax
228 ; CHECK-NEXT: btcq $62, %rax
230 %a = xor i64 %x, 4611686018427387904 ; toggle bit 62
234 define i64 @xor4_optsize(i64 %x) optsize {
235 ; CHECK-LABEL: xor4_optsize:
237 ; CHECK-NEXT: movq %rdi, %rax
238 ; CHECK-NEXT: btcq $63, %rax
240 %a = xor i64 %x, 9223372036854775808 ; toggle bit 63