1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-unknown-unknown | FileCheck %s
4 define i64 @sub1_disguised_constant(i64 %x) {
5 ; CHECK-LABEL: sub1_disguised_constant:
7 ; CHECK-NEXT: sub w8, w0, #1
8 ; CHECK-NEXT: and w8, w0, w8
9 ; CHECK-NEXT: and x0, x8, #0xffff
11 %a1 = and i64 %x, 65535
12 %a2 = add i64 %x, 65535
17 define i8 @masked_sub_i8(i8 %x) {
18 ; CHECK-LABEL: masked_sub_i8:
20 ; CHECK-NEXT: mov w8, #5
21 ; CHECK-NEXT: and w8, w0, w8
22 ; CHECK-NEXT: eor w0, w8, #0x7
29 ; Borrow from the MSB is ok.
31 define i8 @masked_sub_high_bit_mask_i8(i8 %x) {
32 ; CHECK-LABEL: masked_sub_high_bit_mask_i8:
34 ; CHECK-NEXT: mov w8, #-96
35 ; CHECK-NEXT: and w8, w0, w8
36 ; CHECK-NEXT: eor w0, w8, #0x3c
38 %maskx = and i8 %x, 160 ; 0b10100000
39 %s = sub i8 60, %maskx ; 0b00111100
43 define i8 @not_masked_sub_i8(i8 %x) {
44 ; CHECK-LABEL: not_masked_sub_i8:
46 ; CHECK-NEXT: mov w8, #7
47 ; CHECK-NEXT: and w9, w0, #0x8
48 ; CHECK-NEXT: sub w0, w8, w9
55 define i32 @masked_sub_i32(i32 %x) {
56 ; CHECK-LABEL: masked_sub_i32:
58 ; CHECK-NEXT: mov w8, #9
59 ; CHECK-NEXT: and w8, w0, w8
60 ; CHECK-NEXT: eor w0, w8, #0x1f
67 define <4 x i32> @masked_sub_v4i32(<4 x i32> %x) {
68 ; CHECK-LABEL: masked_sub_v4i32:
70 ; CHECK-NEXT: movi v1.4s, #42
71 ; CHECK-NEXT: movi v2.4s, #1, msl #8
72 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
73 ; CHECK-NEXT: eor v0.16b, v0.16b, v2.16b
75 %a = and <4 x i32> %x, <i32 42, i32 42, i32 42, i32 42>
76 %m = sub <4 x i32> <i32 511, i32 511, i32 511, i32 511>, %a