blob: 5fbf38b2560d497dbbc71e8289910c8a76610ca7 [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=aarch64-linux | FileCheck %s
define i8 @andnot_add_with_neg_i8(i8 %a0, i8 %a1) {
; CHECK-LABEL: andnot_add_with_neg_i8:
; CHECK: // %bb.0:
; CHECK-NEXT: sub w8, w0, w1
; CHECK-NEXT: bic w0, w0, w8
; CHECK-NEXT: ret
%not = xor i8 %a0, -1
%sum = add i8 %not, %a1
%and = and i8 %sum, %a0
ret i8 %and
}
define i8 @andnot_sub_with_neg_i8(i8 %a0, i8 %a1) {
; CHECK-LABEL: andnot_sub_with_neg_i8:
; CHECK: // %bb.0:
; CHECK-NEXT: add w8, w0, w1
; CHECK-NEXT: bic w0, w0, w8
; CHECK-NEXT: ret
%not = xor i8 %a0, -1
%diff = sub i8 %not, %a1
%and = and i8 %diff, %a0
ret i8 %and
}
define i16 @andnot_add_with_neg_i16(i16 %a0, i16 %a1) {
; CHECK-LABEL: andnot_add_with_neg_i16:
; CHECK: // %bb.0:
; CHECK-NEXT: sub w8, w0, w1
; CHECK-NEXT: bic w0, w0, w8
; CHECK-NEXT: ret
%not = xor i16 %a0, -1
%sum = add i16 %not, %a1
%and = and i16 %sum, %a0
ret i16 %and
}
define i16 @andnot_sub_with_neg_i16(i16 %a0, i16 %a1) {
; CHECK-LABEL: andnot_sub_with_neg_i16:
; CHECK: // %bb.0:
; CHECK-NEXT: add w8, w0, w1
; CHECK-NEXT: bic w0, w0, w8
; CHECK-NEXT: ret
%not = xor i16 %a0, -1
%diff = sub i16 %not, %a1
%and = and i16 %diff, %a0
ret i16 %and
}
define i32 @andnot_add_with_neg_i32(i32 %a0, i32 %a1) {
; CHECK-LABEL: andnot_add_with_neg_i32:
; CHECK: // %bb.0:
; CHECK-NEXT: sub w8, w0, w1
; CHECK-NEXT: bic w0, w0, w8
; CHECK-NEXT: ret
%not = xor i32 %a0, -1
%sum = add i32 %not, %a1
%and = and i32 %sum, %a0
ret i32 %and
}
define i32 @andnot_sub_with_neg_i32(i32 %a0, i32 %a1) {
; CHECK-LABEL: andnot_sub_with_neg_i32:
; CHECK: // %bb.0:
; CHECK-NEXT: add w8, w0, w1
; CHECK-NEXT: bic w0, w0, w8
; CHECK-NEXT: ret
%not = xor i32 %a0, -1
%diff = sub i32 %not, %a1
%and = and i32 %diff, %a0
ret i32 %and
}
define i64 @andnot_add_with_neg_i64(i64 %a0, i64 %a1) {
; CHECK-LABEL: andnot_add_with_neg_i64:
; CHECK: // %bb.0:
; CHECK-NEXT: sub x8, x0, x1
; CHECK-NEXT: bic x0, x0, x8
; CHECK-NEXT: ret
%not = xor i64 %a0, -1
%sum = add i64 %not, %a1
%and = and i64 %sum, %a0
ret i64 %and
}
define i64 @andnot_sub_with_neg_i64(i64 %a0, i64 %a1) {
; CHECK-LABEL: andnot_sub_with_neg_i64:
; CHECK: // %bb.0:
; CHECK-NEXT: add x8, x0, x1
; CHECK-NEXT: bic x0, x0, x8
; CHECK-NEXT: ret
%not = xor i64 %a0, -1
%diff = sub i64 %not, %a1
%and = and i64 %diff, %a0
ret i64 %and
}