1 ; RUN: llc -o - %s -mtriple=aarch64-- | FileCheck %s
4 ; CHECK: and {{w[0-9]+}}, w0, #0xfffffffd
6 define void @and1(i32 %a, i8* nocapture %p) {
9 %conv = trunc i32 %and to i8
10 store i8 %conv, i8* %p, align 1
14 ; (a & 0x3dfd) | 0xffffc000
17 ; CHECK: and {{w[0-9]+}}, w0, #0xfdfdfdfd
19 define i32 @and2(i32 %a) {
21 %and = and i32 %a, 15869
22 %or = or i32 %and, -16384
26 ; (a & 0x19) | 0xffffffc0
29 ; CHECK: and {{w[0-9]+}}, w0, #0x99999999
31 define i32 @and3(i32 %a) {
34 %or = or i32 %and, -64
38 ; (a & 0xc5600) | 0xfff1f1ff
41 ; CHECK: and {{w[0-9]+}}, w0, #0xfffc07ff
43 define i32 @and4(i32 %a) {
45 %and = and i32 %a, 787968
46 %or = or i32 %and, -921089
50 ; Make sure we don't shrink or optimize an XOR's immediate operand if the
51 ; immediate is -1. Instruction selection turns (and ((xor $mask, -1), $v0)) into
55 ; CHECK: mov [[R0:w[0-9]+]], #56
56 ; CHECK: bic {{w[0-9]+}}, [[R0]], w0, lsl #3
58 define i32 @xor1(i32 %a) {
61 %xor = and i32 %shl, 56
62 %and = xor i32 %xor, 56
66 ; Check that, when (and %t1, 129) is transformed to (and %t0, 0),
67 ; (xor %arg, 129) doesn't get transformed to (xor %arg, 0).
69 ; CHECK-LABEL: PR33100:
70 ; CHECK: mov w[[R0:[0-9]+]], #129
71 ; CHECK: eor {{x[0-9]+}}, {{x[0-9]+}}, x[[R0]]
73 define i64 @PR33100(i64 %arg) {
76 store i64 8, i64* %alloca0, align 4
77 %t0 = load i64, i64* %alloca0, align 4
78 %t1 = shl i64 %arg, %t0
79 %and0 = and i64 %t1, 129
80 %xor0 = xor i64 %arg, 129
81 %t2 = add i64 %and0, %xor0