blob: f41cdc6dd241b205f79653187b9e31f4459a59b7 [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=aarch64-none-elf -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SD
; RUN: llc -mtriple=aarch64-none-elf -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-GI
define i32 @mask_pair(i32 %x, i32 %y) {
; CHECK-SD-LABEL: mask_pair:
; CHECK-SD: // %bb.0:
; CHECK-SD-NEXT: lsr w8, w0, w1
; CHECK-SD-NEXT: lsl w0, w8, w1
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: mask_pair:
; CHECK-GI: // %bb.0:
; CHECK-GI-NEXT: mov w8, #-1 // =0xffffffff
; CHECK-GI-NEXT: lsl w8, w8, w1
; CHECK-GI-NEXT: and w0, w8, w0
; CHECK-GI-NEXT: ret
%shl = shl nsw i32 -1, %y
%and = and i32 %shl, %x
ret i32 %and
}
define i64 @mask_pair_64(i64 %x, i64 %y) {
; CHECK-SD-LABEL: mask_pair_64:
; CHECK-SD: // %bb.0:
; CHECK-SD-NEXT: lsr x8, x0, x1
; CHECK-SD-NEXT: lsl x0, x8, x1
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: mask_pair_64:
; CHECK-GI: // %bb.0:
; CHECK-GI-NEXT: mov x8, #-1 // =0xffffffffffffffff
; CHECK-GI-NEXT: lsl x8, x8, x1
; CHECK-GI-NEXT: and x0, x8, x0
; CHECK-GI-NEXT: ret
%shl = shl nsw i64 -1, %y
%and = and i64 %shl, %x
ret i64 %and
}
define i128 @mask_pair_128(i128 %x, i128 %y) {
; CHECK-SD-LABEL: mask_pair_128:
; CHECK-SD: // %bb.0:
; CHECK-SD-NEXT: mov x8, #-1 // =0xffffffffffffffff
; CHECK-SD-NEXT: mvn w9, w2
; CHECK-SD-NEXT: mov x10, #9223372036854775807 // =0x7fffffffffffffff
; CHECK-SD-NEXT: lsl x8, x8, x2
; CHECK-SD-NEXT: lsr x9, x10, x9
; CHECK-SD-NEXT: tst x2, #0x40
; CHECK-SD-NEXT: orr x9, x8, x9
; CHECK-SD-NEXT: csel x9, x8, x9, ne
; CHECK-SD-NEXT: csel x8, xzr, x8, ne
; CHECK-SD-NEXT: and x0, x8, x0
; CHECK-SD-NEXT: and x1, x9, x1
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: mask_pair_128:
; CHECK-GI: // %bb.0:
; CHECK-GI-NEXT: mov w8, #64 // =0x40
; CHECK-GI-NEXT: mov x9, #-1 // =0xffffffffffffffff
; CHECK-GI-NEXT: sub x10, x2, #64
; CHECK-GI-NEXT: sub x8, x8, x2
; CHECK-GI-NEXT: lsl x11, x9, x2
; CHECK-GI-NEXT: cmp x2, #64
; CHECK-GI-NEXT: lsr x8, x9, x8
; CHECK-GI-NEXT: lsl x9, x9, x10
; CHECK-GI-NEXT: csel x10, x11, xzr, lo
; CHECK-GI-NEXT: orr x8, x8, x11
; CHECK-GI-NEXT: and x0, x10, x0
; CHECK-GI-NEXT: csel x8, x8, x9, lo
; CHECK-GI-NEXT: cmp x2, #0
; CHECK-GI-NEXT: csinv x8, x8, xzr, ne
; CHECK-GI-NEXT: and x1, x8, x1
; CHECK-GI-NEXT: ret
%shl = shl nsw i128 -1, %y
%and = and i128 %shl, %x
ret i128 %and
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK: {{.*}}