-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[LoongArch] lower SCALAR_TO_VECTOR to INSERT_VECTOR_ELT #122863
Merged
+150
−9
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7e36c8d
lower SCALAR_TO_VECTOR to INSERT_VECTOR_ELT
tangaac d574316
lower SCALAR_TO_VECTOR to INSERT_VECTOR_ELT
tangaac 6d36284
Merge branch 'scalar-to-vector' of github.com:tangaac/llvm-project in…
tangaac deae039
minor changes
tangaac 4bba81b
replace undef with poison
tangaac 5cf9af0
simplify scalar_to_vector for float vector types
tangaac a71a98f
Update llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td
tangaac 948416e
Update llvm/lib/Target/LoongArch/LoongArchLASXInstrInfo.td
tangaac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,58 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc --mtriple=loongarch64 --mattr=+lasx < %s | FileCheck %s | ||
|
||
;; Test scalar_to_vector expansion. | ||
|
||
define <32 x i8> @scalar_to_32xi8(i8 %val) { | ||
; CHECK-LABEL: scalar_to_32xi8: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: vinsgr2vr.b $vr0, $a0, 0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <32 x i8> poison, i8 %val, i32 0 | ||
ret <32 x i8> %ret | ||
} | ||
|
||
define <16 x i16> @scalar_to_16xi16(i16 %val) { | ||
; CHECK-LABEL: scalar_to_16xi16: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: vinsgr2vr.h $vr0, $a0, 0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <16 x i16> poison, i16 %val, i32 0 | ||
ret <16 x i16> %ret | ||
} | ||
|
||
define <8 x i32> @scalar_to_8xi32(i32 %val) { | ||
; CHECK-LABEL: scalar_to_8xi32: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: xvinsgr2vr.w $xr0, $a0, 0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <8 x i32> poison, i32 %val, i32 0 | ||
ret <8 x i32> %ret | ||
} | ||
|
||
define <4 x i64> @scalar_to_4xi64(i64 %val) { | ||
; CHECK-LABEL: scalar_to_4xi64: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: xvinsgr2vr.d $xr0, $a0, 0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <4 x i64> poison, i64 %val, i32 0 | ||
ret <4 x i64> %ret | ||
} | ||
|
||
define <8 x float> @scalar_to_8xf32(float %val) { | ||
; CHECK-LABEL: scalar_to_8xf32: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: # kill: def $f0 killed $f0 def $xr0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <8 x float> poison, float %val, i32 0 | ||
ret <8 x float> %ret | ||
} | ||
|
||
define <4 x double> @scalar_to_4xf64(double %val) { | ||
; CHECK-LABEL: scalar_to_4xf64: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: # kill: def $f0_64 killed $f0_64 def $xr0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <4 x double> poison, double %val, i32 0 | ||
ret <4 x double> %ret | ||
} |
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,58 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc --mtriple=loongarch64 --mattr=+lsx < %s | FileCheck %s | ||
|
||
;; Test scalar_to_vector expansion. | ||
|
||
define <16 x i8> @scalar_to_16xi8(i8 %val) { | ||
; CHECK-LABEL: scalar_to_16xi8: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: vinsgr2vr.b $vr0, $a0, 0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <16 x i8> poison, i8 %val, i32 0 | ||
ret <16 x i8> %ret | ||
} | ||
|
||
define <8 x i16> @scalar_to_8xi16(i16 %val) { | ||
; CHECK-LABEL: scalar_to_8xi16: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: vinsgr2vr.h $vr0, $a0, 0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <8 x i16> poison, i16 %val, i32 0 | ||
ret <8 x i16> %ret | ||
} | ||
|
||
define <4 x i32> @scalar_to_4xi32(i32 %val) { | ||
; CHECK-LABEL: scalar_to_4xi32: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: vinsgr2vr.w $vr0, $a0, 0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <4 x i32> poison, i32 %val, i32 0 | ||
ret <4 x i32> %ret | ||
} | ||
|
||
define <2 x i64> @scalar_to_2xi64(i64 %val) { | ||
; CHECK-LABEL: scalar_to_2xi64: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: vinsgr2vr.d $vr0, $a0, 0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <2 x i64> poison, i64 %val, i32 0 | ||
ret <2 x i64> %ret | ||
} | ||
|
||
define <4 x float> @scalar_to_4xf32(float %val) { | ||
; CHECK-LABEL: scalar_to_4xf32: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: # kill: def $f0 killed $f0 def $vr0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <4 x float> poison, float %val, i32 0 | ||
ret <4 x float> %ret | ||
} | ||
|
||
define <2 x double> @scalar_to_2xf64(double %val) { | ||
; CHECK-LABEL: scalar_to_2xf64: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: # kill: def $f0_64 killed $f0_64 def $vr0 | ||
; CHECK-NEXT: ret | ||
%ret = insertelement <2 x double> poison, double %val, i32 0 | ||
ret <2 x double> %ret | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Seems these could be
empty
because FR overlap with the lower part of the SIMD register.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.
vector_insert
in .td files cannot deal with this.We could make v4f32, v2f64
Legal
, and processscalar_to_vector
in .td files like this,