-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[X86] Add MMX/SSE/AVX PHADD/SUB & HADDPS/D intrinsics to be used in constexpr #156822
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
Merged
Merged
Changes from 21 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
a81c406
deal this issues 155395
2fadf3f
deal issues 15595
f8362b4
Merge branch 'llvm:main' into main
whytolearn ed4a09f
constexpr deal
df6242e
adjust unit test #146940
9f2fb43
Merge remote-tracking branch 'upstream/main'
929d7c0
Merge branch 'main' into main
whytolearn f91aa21
adjust test case and function
4f5fb87
undo the unintentional formatting of the code
2422cd4
Merge branch 'main' into main
whytolearn a3575c5
Merge branch 'main' into main
whytolearn b2cac3e
adjust code
197123a
adjust code for mm256
b733157
format code
1ce4883
Merge branch 'main' into main
whytolearn 9a7c138
deal all 256 double pane ins
a65f4fc
deal all 256 double pane ins
9877317
adjust for 128 and 256 oprand
404d261
Merge branch 'main' into main
whytolearn 1d61bf2
undo some bad format for .td file
b25aa5e
Merge branch 'main' into main
whytolearn 4bc2341
merge disperse operation
242165a
Merge remote-tracking branch 'upstream/main'
d2e5d43
Merge remote-tracking branch 'upstream/main'
6d57df0
Merge branch 'main' into main
whytolearn 03e4db0
Merge branch 'main' into main
RKSimon c2117f6
Update clang/lib/AST/ByteCode/InterpBuiltin.cpp
whytolearn 5c7412f
Update clang/lib/AST/ByteCode/InterpBuiltin.cpp
whytolearn 90200be
Merge branch 'main' into main
whytolearn 5df6aff
Update clang/lib/AST/ExprConstant.cpp
whytolearn 202c165
bad merger delate and code format
34ee8ed
Merge branch 'main' into main
whytolearn 9ec2672
Merge branch 'main' into main
whytolearn 7e15580
Merge branch 'main' into main
RKSimon 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 hidden or 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 |
|---|---|---|
|
|
@@ -110,19 +110,21 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<128>] in { | |
| } | ||
|
|
||
| let Features = "sse3" in { | ||
| foreach Op = ["addsub", "hadd", "hsub"] in { | ||
| foreach Op = ["addsub"] in { | ||
| def Op#ps : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Vector<4, float>)">; | ||
| def Op#pd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Vector<2, double>)">; | ||
| } | ||
| } | ||
|
|
||
| let Features = "ssse3" in { | ||
| foreach Op = ["phadd", "phsub"] in { | ||
| def Op#w128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">; | ||
| def Op#sw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">; | ||
| def Op#d128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>)">; | ||
| let Features = "sse3", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in { | ||
| foreach Op = ["hadd", "hsub"] in { | ||
| def Op#ps : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Vector<4, float>)">; | ||
| def Op#pd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Vector<2, double>)">; | ||
| } | ||
| } | ||
|
|
||
| let Features = "ssse3" in { | ||
| def pmaddubsw128 : X86Builtin<"_Vector<8, short>(_Vector<16, char>, _Vector<16, char>)">; | ||
| def pmulhrsw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">; | ||
| def pshufb128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Vector<16, char>)">; | ||
| def psignb128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Vector<16, char>)">; | ||
|
|
@@ -137,7 +139,7 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<128>] in { | |
|
|
||
| // AVX | ||
| let Attributes = [Const, NoThrow, RequiredVectorWidth<256>], Features = "avx" in { | ||
| foreach Op = ["addsub", "hadd", "hsub", "max", "min"] in { | ||
| foreach Op = ["addsub", "max", "min"] in { | ||
| def Op#pd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<4, double>)">; | ||
| def Op#ps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, float>)">; | ||
| } | ||
|
|
@@ -316,6 +318,14 @@ let Features = "ssse3", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] | |
| def palignr128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Vector<16, char>, _Constant int)">; | ||
| } | ||
|
|
||
| let Features = "ssse3", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in { | ||
| foreach Op = ["phadd", "phsub"] in { | ||
| def Op#w128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">; | ||
| def Op#sw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">; | ||
| def Op#d128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>)">; | ||
| } | ||
| } | ||
|
|
||
| let Features = "sse4.1", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in { | ||
| def insertps128 : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Vector<4, float>, _Constant char)">; | ||
| def roundps : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Constant int)">; | ||
|
|
@@ -507,6 +517,11 @@ let Features = "avx", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWid | |
| def vinsertf128_pd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<2, double>, _Constant int)">; | ||
| def vinsertf128_ps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<4, float>, _Constant int)">; | ||
| def vinsertf128_si256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>, _Constant int)">; | ||
|
|
||
| foreach Op = ["hadd", "hsub"] in { | ||
| def Op#pd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<4, double>)">; | ||
| def Op#ps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, float>)">; | ||
| } | ||
| } | ||
|
|
||
| let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in { | ||
|
|
@@ -579,6 +594,8 @@ let Features = "avx", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWid | |
| let Features = "avx2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in { | ||
| def mpsadbw256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Vector<32, char>, _Constant char)">; | ||
| def palignr256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Vector<32, char>, _Constant int)">; | ||
| def pmaddubsw256 : X86Builtin<"_Vector<16, short>(_Vector<32, char>, _Vector<32, char>)">; | ||
| def pmaddwd256 : X86Builtin<"_Vector<8, int>(_Vector<16, short>, _Vector<16, short>)">; | ||
|
||
| def phaddw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">; | ||
| def phaddd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>)">; | ||
| def phaddsw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">; | ||
|
|
@@ -653,6 +670,13 @@ let Features = "avx2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWi | |
| def packssdw256 : X86Builtin<"_Vector<16, short>(_Vector<8, int>, _Vector<8, int>)">; | ||
| def packuswb256 : X86Builtin<"_Vector<32, char>(_Vector<16, short>, _Vector<16, short>)">; | ||
|
|
||
| def phaddw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">; | ||
| def phaddd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>)">; | ||
| def phaddsw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">; | ||
| def phsubw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">; | ||
| def phsubd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>)">; | ||
| def phsubsw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">; | ||
|
|
||
| def pshuflw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Constant int)">; | ||
| def pshufhw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Constant int)">; | ||
| def pshufd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Constant int)">; | ||
|
|
||
This file contains hidden or 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.
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.
pmaddubsw128 is now defined somewhere else as constexpr - please remove this line
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.
yes, my merge error