-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[CIR][X86] Implement lowering for sqrt builtins #169310
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
+81
−3
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
627bcb3
Add CIR sqrt builtin support for X86
Priyanshu3820 d095f5a
Merge branch 'main' into cir-sqrtps-impl
Priyanshu3820 8c13c6f
Merge branch 'main' into cir-sqrtps-impl
Priyanshu3820 17a3e66
Merge branch 'main' into cir-sqrtps-impl
Priyanshu3820 01bb815
Merge branch 'main' into cir-sqrtps-impl
Priyanshu3820 4a39fd7
Implement sqrt builtins for all vector sizes
Priyanshu3820 ef3fd97
Test file renamed
Priyanshu3820 9705673
Add sqrt changes patch
Priyanshu3820 21119e5
group with other floating point ops
Priyanshu3820 90878ec
place the implementation with other floating point ops
Priyanshu3820 3529f40
Update clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
Priyanshu3820 92d0ac3
Update clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
Priyanshu3820 0385662
Update clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
Priyanshu3820 ddcb7b8
update clang\lib\CIR\Lowering\DirectToLLVM\LowerToLLVM.cpp
Priyanshu3820 1e846e7
update clang\lib\CIR\Lowering\DirectToLLVM\LowerToLLVM.cpp
Priyanshu3820 233efad
Update clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.h
Priyanshu3820 9d940bc
Update clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
Priyanshu3820 51bbcca
Remove BOM character
Priyanshu3820 f901f03
Merge branch 'cir-sqrtps-impl' of https://github.com/Priyanshu3820/ll…
Priyanshu3820 e5789b6
Apply suggestion from @Copilot
Priyanshu3820 8937b12
Apply suggestion from @andykaylor
Priyanshu3820 8a02c50
add description
Priyanshu3820 9923a62
Resolve merge conflict in LowerToLLVM.cpp
Priyanshu3820 82a9395
Remove undefined sqrt builtin cases
Priyanshu3820 6bd3282
Remove unused getLLVMIntrinsicNameForType function
Priyanshu3820 8232ce8
Removed braces
Priyanshu3820 bc8e4cc
Update clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
Priyanshu3820 9284761
update clang\lib\CIR\Lowering\DirectToLLVM\LowerToLLVM.h
Priyanshu3820 8647b5c
Update clang/test/CIR/CodeGen/X86/cir-sqrt-builtins.c
Priyanshu3820 4bac65a
Update test
Priyanshu3820 b1ff2ab
update clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
Priyanshu3820 8843006
Remove unused include
Priyanshu3820 ed82423
Move sqrt lowering with other floating point operations
Priyanshu3820 9e8bec2
Merge branch 'main' into cir-sqrtps-impl
Priyanshu3820 961c9f9
Remove BOM character
Priyanshu3820 e5d1a6d
gergeebranch 'cir-sqrtps-impl' of https://github.com/Priyanshu3820/ll…
Priyanshu3820 44ddd79
Merge branch 'main' into cir-sqrtps-impl
Priyanshu3820 4dd8aa0
Delete my-sqrt-changes.patch
Priyanshu3820 cc5ffa1
Update errorNYI call
Priyanshu3820 6d43c43
Merge branch 'cir-sqrtps-impl' of https://github.com/Priyanshu3820/ll…
Priyanshu3820 47f9b2f
update clang\lib\CIR\Lowering\DirectToLLVM\LowerToLLVM.cpp
Priyanshu3820 15f1f4f
update clang/test/CIR/CodeGen/X86/cir-sqrt-builtins.c
Priyanshu3820 b12779a
Fix line endings in CIRGenBuiltinX86.cpp
Priyanshu3820 996b7e7
Fix formatting
andykaylor 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
Some comments aren't visible on the classic Files Changed page.
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
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
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
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 |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // Test X86-specific sqrt builtins | ||
|
|
||
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir | ||
| // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s | ||
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll | ||
| // RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s | ||
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature +avx512f -target-feature +avx512fp16 -emit-llvm %s -o %t.ll | ||
| // RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s | ||
|
|
||
| typedef float __m512 __attribute__((__vector_size__(64), __aligned__(64))); | ||
| typedef double __m512d __attribute__((__vector_size__(64), __aligned__(64))); | ||
| typedef _Float16 __m512h __attribute__((__vector_size__(64), __aligned__(64))); | ||
|
|
||
| // Test __builtin_ia32_sqrtph512 | ||
| __m512h test_sqrtph512(__m512h a) { | ||
| return __builtin_ia32_sqrtph512(a, 4); | ||
| } | ||
| // CIR-LABEL: cir.func {{.*}}@test_sqrtph512 | ||
| // CIR: cir.sqrt {{%.*}} : !cir.vector<32 x !cir.f16> | ||
| // LLVM-LABEL: define {{.*}} @test_sqrtph512 | ||
| // LLVM: call <32 x half> @llvm.sqrt.v32f16 | ||
| // OGCG-LABEL: define {{.*}} @test_sqrtph512 | ||
| // OGCG: call <32 x half> @llvm.sqrt.v32f16 | ||
|
|
||
| // Test __builtin_ia32_sqrtps512 | ||
| __m512 test_sqrtps512(__m512 a) { | ||
| return __builtin_ia32_sqrtps512(a, 4); | ||
| } | ||
| // CIR-LABEL: cir.func {{.*}}@test_sqrtps512 | ||
| // CIR: cir.sqrt {{%.*}} : !cir.vector<16 x !cir.float> | ||
| // LLVM-LABEL: define {{.*}} @test_sqrtps512 | ||
| // LLVM: call <16 x float> @llvm.sqrt.v16f32 | ||
| // OGCG-LABEL: define {{.*}} @test_sqrtps512 | ||
| // OGCG: call <16 x float> @llvm.sqrt.v16f32 | ||
|
|
||
| // Test __builtin_ia32_sqrtpd512 | ||
| __m512d test_sqrtpd512(__m512d a) { | ||
| return __builtin_ia32_sqrtpd512(a, 4); | ||
| } | ||
| // CIR-LABEL: cir.func {{.*}}@test_sqrtpd512 | ||
| // CIR: cir.sqrt {{%.*}} : !cir.vector<8 x !cir.double> | ||
| // LLVM-LABEL: define {{.*}} @test_sqrtpd512 | ||
| // LLVM: call <8 x double> @llvm.sqrt.v8f64 | ||
| // OGCG-LABEL: define {{.*}} @test_sqrtpd512 | ||
| // OGCG: call <8 x double> @llvm.sqrt.v8f64 |
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.
Can you add a description with an example of the CIR format?
We're trying to standardize the descriptions of all our operations to include an example.
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.
I had done that initially but removed the example after seeing other floating point ops didn't have examples too. Added it again now.