Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AArch64][SVE] Add patterns for logical immediate operations.
Summary: Add pattern matching for the following SVE logical vector and immediate instructions: - and/bic, orr/orn, eor/eon. Reviewers: sdesmalen, huntergr, rengolin, efriedma, c-rhodes, mgudim, kmclaughlin Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits, amehsan Tags: #llvm Differential Revision: https://reviews.llvm.org/D71483
- Loading branch information
Danilo Carvalho Grael
committed
Dec 16, 2019
1 parent
f9a706a
commit f933878
Showing
5 changed files
with
188 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s | ||
|
||
define <vscale x 16 x i8> @orr_i8(<vscale x 16 x i8> %a) { | ||
; CHECK-LABEL: orr_i8: | ||
; CHECK: orr z0.b, z0.b, #0xf | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 16 x i8> @llvm.aarch64.sve.orr.imm.nxv16i8(<vscale x 16 x i8> %a, | ||
i64 15) | ||
ret <vscale x 16 x i8> %res | ||
} | ||
|
||
define <vscale x 8 x i16> @orr_i16(<vscale x 8 x i16> %a) { | ||
; CHECK-LABEL: orr_i16: | ||
; CHECK: orr z0.h, z0.h, #0xfc07 | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 8 x i16> @llvm.aarch64.sve.orr.imm.nxv8i16(<vscale x 8 x i16> %a, | ||
i64 64519) | ||
ret <vscale x 8 x i16> %res | ||
} | ||
|
||
define <vscale x 4 x i32> @orr_i32(<vscale x 4 x i32> %a) { | ||
; CHECK-LABEL: orr_i32: | ||
; CHECK: orr z0.s, z0.s, #0xffff00 | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 4 x i32> @llvm.aarch64.sve.orr.imm.nxv4i32(<vscale x 4 x i32> %a, | ||
i64 16776960) | ||
ret <vscale x 4 x i32> %res | ||
} | ||
|
||
define <vscale x 2 x i64> @orr_i64(<vscale x 2 x i64> %a) { | ||
; CHECK-LABEL: orr_i64: | ||
; CHECK: orr z0.d, z0.d, #0xfffc000000000000 | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 2 x i64> @llvm.aarch64.sve.orr.imm.nxv2i64(<vscale x 2 x i64> %a, | ||
i64 18445618173802708992) | ||
ret <vscale x 2 x i64> %res | ||
} | ||
|
||
define <vscale x 16 x i8> @eor_i8(<vscale x 16 x i8> %a) { | ||
; CHECK-LABEL: eor_i8: | ||
; CHECK: eor z0.b, z0.b, #0xf | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 16 x i8> @llvm.aarch64.sve.eor.imm.nxv16i8(<vscale x 16 x i8> %a, | ||
i64 15) | ||
ret <vscale x 16 x i8> %res | ||
} | ||
|
||
define <vscale x 8 x i16> @eor_i16(<vscale x 8 x i16> %a) { | ||
; CHECK-LABEL: eor_i16: | ||
; CHECK: eor z0.h, z0.h, #0xfc07 | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 8 x i16> @llvm.aarch64.sve.eor.imm.nxv8i16(<vscale x 8 x i16> %a, | ||
i64 64519) | ||
ret <vscale x 8 x i16> %res | ||
} | ||
|
||
define <vscale x 4 x i32> @eor_i32(<vscale x 4 x i32> %a) { | ||
; CHECK-LABEL: eor_i32: | ||
; CHECK: eor z0.s, z0.s, #0xffff00 | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 4 x i32> @llvm.aarch64.sve.eor.imm.nxv4i32(<vscale x 4 x i32> %a, | ||
i64 16776960) | ||
ret <vscale x 4 x i32> %res | ||
} | ||
|
||
define <vscale x 2 x i64> @eor_i64(<vscale x 2 x i64> %a) { | ||
; CHECK-LABEL: eor_i64: | ||
; CHECK: eor z0.d, z0.d, #0xfffc000000000000 | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 2 x i64> @llvm.aarch64.sve.eor.imm.nxv2i64(<vscale x 2 x i64> %a, | ||
i64 18445618173802708992) | ||
ret <vscale x 2 x i64> %res | ||
} | ||
|
||
define <vscale x 16 x i8> @and_i8(<vscale x 16 x i8> %a) { | ||
; CHECK-LABEL: and_i8: | ||
; CHECK: and z0.b, z0.b, #0xf | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 16 x i8> @llvm.aarch64.sve.and.imm.nxv16i8(<vscale x 16 x i8> %a, | ||
i64 15) | ||
ret <vscale x 16 x i8> %res | ||
} | ||
|
||
define <vscale x 8 x i16> @and_i16(<vscale x 8 x i16> %a) { | ||
; CHECK-LABEL: and_i16: | ||
; CHECK: and z0.h, z0.h, #0xfc07 | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 8 x i16> @llvm.aarch64.sve.and.imm.nxv8i16(<vscale x 8 x i16> %a, | ||
i64 64519) | ||
ret <vscale x 8 x i16> %res | ||
} | ||
|
||
define <vscale x 4 x i32> @and_i32(<vscale x 4 x i32> %a) { | ||
; CHECK-LABEL: and_i32: | ||
; CHECK: and z0.s, z0.s, #0xffff00 | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 4 x i32> @llvm.aarch64.sve.and.imm.nxv4i32(<vscale x 4 x i32> %a, | ||
i64 16776960) | ||
ret <vscale x 4 x i32> %res | ||
} | ||
|
||
define <vscale x 2 x i64> @and_i64(<vscale x 2 x i64> %a) { | ||
; CHECK-LABEL: and_i64: | ||
; CHECK: and z0.d, z0.d, #0xfffc000000000000 | ||
; CHECK-NEXT: ret | ||
%res = call <vscale x 2 x i64> @llvm.aarch64.sve.and.imm.nxv2i64(<vscale x 2 x i64> %a, | ||
i64 18445618173802708992) | ||
ret <vscale x 2 x i64> %res | ||
} | ||
|
||
declare <vscale x 16 x i8> @llvm.aarch64.sve.orr.imm.nxv16i8(<vscale x 16 x i8>, i64) | ||
declare <vscale x 8 x i16> @llvm.aarch64.sve.orr.imm.nxv8i16(<vscale x 8 x i16>, i64) | ||
declare <vscale x 4 x i32> @llvm.aarch64.sve.orr.imm.nxv4i32(<vscale x 4 x i32>, i64) | ||
declare <vscale x 2 x i64> @llvm.aarch64.sve.orr.imm.nxv2i64(<vscale x 2 x i64>, i64) | ||
declare <vscale x 16 x i8> @llvm.aarch64.sve.eor.imm.nxv16i8(<vscale x 16 x i8>, i64) | ||
declare <vscale x 8 x i16> @llvm.aarch64.sve.eor.imm.nxv8i16(<vscale x 8 x i16>, i64) | ||
declare <vscale x 4 x i32> @llvm.aarch64.sve.eor.imm.nxv4i32(<vscale x 4 x i32>, i64) | ||
declare <vscale x 2 x i64> @llvm.aarch64.sve.eor.imm.nxv2i64(<vscale x 2 x i64>, i64) | ||
declare <vscale x 16 x i8> @llvm.aarch64.sve.and.imm.nxv16i8(<vscale x 16 x i8>, i64) | ||
declare <vscale x 8 x i16> @llvm.aarch64.sve.and.imm.nxv8i16(<vscale x 8 x i16>, i64) | ||
declare <vscale x 4 x i32> @llvm.aarch64.sve.and.imm.nxv4i32(<vscale x 4 x i32>, i64) | ||
declare <vscale x 2 x i64> @llvm.aarch64.sve.and.imm.nxv2i64(<vscale x 2 x i64>, i64) |