-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[AArch64][InstCombine] Canonicalize whilelo intrinsic #151553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
f4711c6
90ba31b
e400fe1
614b6f9
61572eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: opt -S -passes=instcombine < %s | FileCheck %s | ||
|
|
||
| target triple = "aarch64-unknown-linux-gnu" | ||
|
|
||
|
|
||
| define <vscale x 4 x float> @const_whilelo_nxv4i32(ptr %0) #0 { | ||
| ; CHECK-LABEL: define <vscale x 4 x float> @const_whilelo_nxv4i32( | ||
| ; CHECK-SAME: ptr [[TMP0:%.*]]) { | ||
| ; CHECK-NEXT: [[MASK:%.*]] = call <vscale x 4 x i1> @llvm.get.active.lane.mask.nxv4i1.i32(i32 0, i32 4) | ||
| ; CHECK-NEXT: [[LOAD:%.*]] = tail call <vscale x 4 x float> @llvm.masked.load.nxv4f32.p0(ptr nonnull [[TMP0]], i32 1, <vscale x 4 x i1> [[MASK]], <vscale x 4 x float> zeroinitializer) | ||
| ; CHECK-NEXT: ret <vscale x 4 x float> [[LOAD]] | ||
| ; | ||
| %mask = tail call <vscale x 4 x i1> @llvm.aarch64.sve.whilelo.nxv4i1.i32(i32 0, i32 4) | ||
|
||
| %load = tail call <vscale x 4 x float> @llvm.masked.load.nxv4f32.p0(ptr nonnull %0, i32 1, <vscale x 4 x i1> %mask, <vscale x 4 x float> zeroinitializer) | ||
| ret <vscale x 4 x float> %load | ||
| } | ||
|
|
||
| define <vscale x 8 x float> @const_whilelo_nxv8f32(ptr %0) #0 { | ||
| ; CHECK-LABEL: define <vscale x 8 x float> @const_whilelo_nxv8f32( | ||
| ; CHECK-SAME: ptr [[TMP0:%.*]]) { | ||
| ; CHECK-NEXT: [[MASK:%.*]] = call <vscale x 8 x i1> @llvm.get.active.lane.mask.nxv8i1.i32(i32 0, i32 8) | ||
| ; CHECK-NEXT: [[LOAD:%.*]] = tail call <vscale x 8 x float> @llvm.masked.load.nxv8f32.p0(ptr nonnull [[TMP0]], i32 1, <vscale x 8 x i1> [[MASK]], <vscale x 8 x float> zeroinitializer) | ||
| ; CHECK-NEXT: ret <vscale x 8 x float> [[LOAD]] | ||
| ; | ||
| %mask = tail call <vscale x 8 x i1> @llvm.aarch64.sve.whilelo.nxv8i1.i32(i32 0, i32 8) | ||
| %load = tail call <vscale x 8 x float> @llvm.masked.load.nxv8f32.p0(ptr nonnull %0, i32 1, <vscale x 8 x i1> %mask, <vscale x 8 x float> zeroinitializer) | ||
| ret <vscale x 8 x float> %load | ||
| } | ||
|
|
||
| define <vscale x 8 x i16> @const_whilelo_nxv8i16(ptr %0) #0 { | ||
| ; CHECK-LABEL: define <vscale x 8 x i16> @const_whilelo_nxv8i16( | ||
| ; CHECK-SAME: ptr [[TMP0:%.*]]) { | ||
| ; CHECK-NEXT: [[MASK:%.*]] = call <vscale x 8 x i1> @llvm.get.active.lane.mask.nxv8i1.i32(i32 0, i32 8) | ||
| ; CHECK-NEXT: [[LOAD:%.*]] = tail call <vscale x 8 x i16> @llvm.masked.load.nxv8i16.p0(ptr nonnull [[TMP0]], i32 1, <vscale x 8 x i1> [[MASK]], <vscale x 8 x i16> zeroinitializer) | ||
| ; CHECK-NEXT: ret <vscale x 8 x i16> [[LOAD]] | ||
| ; | ||
| %mask = tail call <vscale x 8 x i1> @llvm.aarch64.sve.whilelo.nxv8i1.i16(i32 0, i32 8) | ||
| %load = tail call <vscale x 8 x i16> @llvm.masked.load.nxv8i16.p0(ptr nonnull %0, i32 1, <vscale x 8 x i1> %mask, <vscale x 8 x i16> zeroinitializer) | ||
| ret <vscale x 8 x i16> %load | ||
| } | ||
|
|
||
| define <vscale x 16 x i8> @const_whilelo_nxv16i8(ptr %0) #0 { | ||
|
||
| ; CHECK-LABEL: define <vscale x 16 x i8> @const_whilelo_nxv16i8( | ||
| ; CHECK-SAME: ptr [[TMP0:%.*]]) { | ||
| ; CHECK-NEXT: [[MASK:%.*]] = call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i32(i32 0, i32 16) | ||
| ; CHECK-NEXT: [[LOAD:%.*]] = tail call <vscale x 16 x i8> @llvm.masked.load.nxv16i8.p0(ptr nonnull [[TMP0]], i32 1, <vscale x 16 x i1> [[MASK]], <vscale x 16 x i8> zeroinitializer) | ||
| ; CHECK-NEXT: ret <vscale x 16 x i8> [[LOAD]] | ||
| ; | ||
| %mask = tail call <vscale x 16 x i1> @llvm.aarch64.sve.whilelo.nxv16i1.i8(i32 0, i32 16) | ||
| %load = tail call <vscale x 16 x i8> @llvm.masked.load.nxv16i8.p0(ptr nonnull %0, i32 1, <vscale x 16 x i1> %mask, <vscale x 16 x i8> zeroinitializer) | ||
| ret <vscale x 16 x i8> %load | ||
| } | ||
|
|
||
|
|
||
| define <vscale x 16 x i8> @whilelo_nxv16i8(ptr %0, i32 %a, i32 %b) #0 { | ||
| ; CHECK-LABEL: define <vscale x 16 x i8> @whilelo_nxv16i8( | ||
| ; CHECK-SAME: ptr [[TMP0:%.*]], i32 [[A:%.*]], i32 [[B:%.*]]) { | ||
| ; CHECK-NEXT: [[MASK:%.*]] = call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i32(i32 [[A]], i32 [[B]]) | ||
| ; CHECK-NEXT: [[LOAD:%.*]] = tail call <vscale x 16 x i8> @llvm.masked.load.nxv16i8.p0(ptr nonnull [[TMP0]], i32 1, <vscale x 16 x i1> [[MASK]], <vscale x 16 x i8> zeroinitializer) | ||
| ; CHECK-NEXT: ret <vscale x 16 x i8> [[LOAD]] | ||
| ; | ||
| %mask = tail call <vscale x 16 x i1> @llvm.aarch64.sve.whilelo.nxv16i1.i8(i32 %a, i32 %b) | ||
| %load = tail call <vscale x 16 x i8> @llvm.masked.load.nxv16i8.p0(ptr nonnull %0, i32 1, <vscale x 16 x i1> %mask, <vscale x 16 x i8> zeroinitializer) | ||
| ret <vscale x 16 x i8> %load | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth adding at least one test for the i64 variant too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I've addressed all of your comments