-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[Hexagon] Support lowering of setuo & seto for vector types in Hexagon #158740
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 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6588982
[Hexagon] Support lowering of setuo & seto for vector types in Hexagon
kaushik-quicinc deeed94
Add check for setO
fhossein-quic 6cd424a
add checks for second var as an operand
fhossein-quic 5957719
clang-format
fhossein-quic 381fb2f
Merge branch 'main' into upstream_setuo_seto
fhossein-quic 1298609
Merge branch 'main' into upstream_setuo_seto
fhossein-quic 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
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,74 @@ | ||
;; RUN: llc --mtriple=hexagon -mattr=+hvxv79,+hvx-length128b %s -o - | FileCheck %s | ||
|
||
define dso_local void @store_isnan_f32(ptr %a, ptr %isnan_a) local_unnamed_addr { | ||
entry: | ||
%arrayidx = getelementptr inbounds nuw float, ptr %a, i32 0 | ||
%0 = load <32 x float>, ptr %arrayidx, align 4 | ||
%.vectorized = fcmp uno <32 x float> %0, zeroinitializer | ||
%.LS.instance = zext <32 x i1> %.vectorized to <32 x i32> | ||
%arrayidx1 = getelementptr inbounds nuw i32, ptr %isnan_a, i32 0 | ||
store <32 x i32> %.LS.instance, ptr %arrayidx1, align 4 | ||
ret void | ||
} | ||
; CHECK: store_isnan_f32 | ||
; CHECK: [[VZERO32:v[0-9]+]] = vxor([[VZERO32]],[[VZERO32]]) | ||
; CHECK: [[VLOAD32:v[0-9]+]] = vmemu(r0+#0) | ||
; CHECK: [[VONES32:v[0-9]+]] = vsplat([[RONE32:r[0-9]+]]) | ||
; CHECK: {{q[0-9]+}} = vcmp.eq([[VLOAD32]].w,[[VLOAD32]].w) | ||
; CHECK: [[VOUT32:v[0-9]+]] = vmux({{q[0-9]+}},[[VZERO32]],[[VONES32]]) | ||
; CHECK: vmemu(r1+#0) = [[VOUT32]] | ||
|
||
|
||
define dso_local void @store_isnan_f16(ptr %a, ptr %isnan_a) local_unnamed_addr { | ||
entry: | ||
%arrayidx = getelementptr inbounds nuw half, ptr %a, i32 0 | ||
%0 = load <64 x half>, ptr %arrayidx, align 2 | ||
%.vectorized = fcmp uno <64 x half> %0, zeroinitializer | ||
%conv.LS.instance = zext <64 x i1> %.vectorized to <64 x i16> | ||
%arrayidx1 = getelementptr inbounds nuw i16, ptr %isnan_a, i32 0 | ||
store <64 x i16> %conv.LS.instance, ptr %arrayidx1, align 2 | ||
ret void | ||
} | ||
; CHECK: store_isnan_f16 | ||
; CHECK: [[VZERO16:v[0-9]+]] = vxor([[VZERO16]],[[VZERO16]]) | ||
; CHECK: [[VLOAD16:v[0-9]+]] = vmemu(r0+#0) | ||
; CHECK: [[VONES16:v[0-9]+]].h = vsplat([[RONE16:r[0-9]+]]) | ||
; CHECK: {{q[0-9]+}} = vcmp.eq([[VLOAD16]].h,[[VLOAD16]].h) | ||
; CHECK: [[VOUT16:v[0-9]+]] = vmux({{q[0-9]+}},[[VZERO16]],[[VONES16]]) | ||
; CHECK: vmemu(r1+#0) = [[VOUT16]] | ||
|
||
define dso_local void @store_isordered_f32(ptr %a, ptr %isordered_a) local_unnamed_addr { | ||
entry: | ||
%arrayidx = getelementptr inbounds nuw float, ptr %a, i32 0 | ||
%0 = load <32 x float>, ptr %arrayidx, align 4 | ||
%.vectorized = fcmp ord <32 x float> %0, zeroinitializer | ||
%.LS.instance = zext <32 x i1> %.vectorized to <32 x i32> | ||
%arrayidx1 = getelementptr inbounds nuw i32, ptr %isordered_a, i32 0 | ||
store <32 x i32> %.LS.instance, ptr %arrayidx1, align 4 | ||
ret void | ||
} | ||
; CHECK: store_isordered_f32 | ||
; CHECK: [[V_ZERO32:v[0-9]+]] = vxor([[V_ZERO32]],[[V_ZERO32]]) | ||
; CHECK: [[V_LOAD32:v[0-9]+]] = vmemu(r0+#0) | ||
; CHECK: [[V_ONES32:v[0-9]+]] = vsplat([[RO32:r[0-9]+]]) | ||
; CHECK: {{q[0-9]+}} = vcmp.eq([[V_LOAD32]].w,[[V_LOAD32]].w) | ||
; CHECK: [[V_OUT32:v[0-9]+]] = vmux({{q[0-9]+}},[[V_ONES32]],[[V_ZERO32]]) | ||
; CHECK: vmemu(r1+#0) = [[V_OUT32]] | ||
|
||
define dso_local void @store_isordered_f16(ptr %a, ptr %isordered_a) local_unnamed_addr { | ||
entry: | ||
%arrayidx = getelementptr inbounds nuw half, ptr %a, i32 0 | ||
%0 = load <64 x half>, ptr %arrayidx, align 2 | ||
%.vectorized = fcmp ord <64 x half> %0, zeroinitializer | ||
%conv.LS.instance = zext <64 x i1> %.vectorized to <64 x i16> | ||
%arrayidx1 = getelementptr inbounds nuw i16, ptr %isordered_a, i32 0 | ||
store <64 x i16> %conv.LS.instance, ptr %arrayidx1, align 2 | ||
ret void | ||
} | ||
; CHECK: store_isordered_f16 | ||
; CHECK: [[V_ZERO16:v[0-9]+]] = vxor([[V_ZERO16]],[[V_ZERO16]]) | ||
; CHECK: [[V_LOAD16:v[0-9]+]] = vmemu(r0+#0) | ||
; CHECK: [[V_ONES16:v[0-9]+]].h = vsplat([[RO16:r[0-9]+]]) | ||
; CHECK: {{q[0-9]+}} = vcmp.eq([[V_LOAD16]].h,[[V_LOAD16]].h) | ||
; CHECK: [[V_OUT16:v[0-9]+]] = vmux({{q[0-9]+}},[[V_ONES16]],[[V_ZERO16]]) | ||
; CHECK: vmemu(r1+#0) = [[V_OUT16]] | ||
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.
Thanks for adding more test cases, but none of these examples here are great because the second operand is 0. Can you add testcases where the second operand to fcmp is not 0?
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 for catching this. I've made changes so that the second operand is a var as well. Please let me know if it addresses your comment