diff options
author | Daniel Sanders <daniel.sanders@imgtec.com> | 2014-03-12 11:54:00 +0000 |
---|---|---|
committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2014-03-12 11:54:00 +0000 |
commit | df221545793e222ab7870054eb7a220183f6ce7a (patch) | |
tree | 5af6bce093b816aaaac2099f6fd17746454c7323 /llvm/test/CodeGen/Mips/msa/vec.ll | |
parent | bd58580cb81ed26eb0ae6ffb3270adfb27b44f6e (diff) | |
download | bcm5719-llvm-df221545793e222ab7870054eb7a220183f6ce7a.tar.gz bcm5719-llvm-df221545793e222ab7870054eb7a220183f6ce7a.zip |
[mips] BSEL's and BINS[RL] operands are reversed compared to the vselect node used in the pattern.
Summary:
Correct the match patterns and the lowerings that made the CodeGen tests pass despite the mistakes.
The original testcase that discovered the problem was SingleSource/UnitTests/SignlessType/factor.c in test-suite.
During review, we also found that some of the existing CodeGen tests were incorrect and fixed them:
* bitwise.ll: In bsel_v16i8 the IfSet/IfClear were reversed because bsel and bmnz have different operand orders and the test didn't correctly account for this. bmnz goes 'IfClear, IfSet, CondMask', while bsel goes 'CondMask, IfClear, IfSet'.
* vec.ll: In the cases where a bsel is emitted as a bmnz (they are the same operation with a different input tied to the result) the operands were in the wrong order.
* compare.ll and compare_float.ll: The bsel operand order was correct for a greater-than comparison, but a greater-than comparison instruction doesn't exist. Lowering this operation inverts the condition so the IfSet/IfClear need to be swapped to match.
The differences between BSEL, BMNZ, and BMZ and how they map to/from vselect are rather confusing. I've therefore added a note to MSA.txt to explain this in a single place in addition to the comments that explain each case.
Reviewers: matheusalmeida, jacksprat
Reviewed By: matheusalmeida
Differential Revision: http://llvm-reviews.chandlerc.com/D3028
llvm-svn: 203657
Diffstat (limited to 'llvm/test/CodeGen/Mips/msa/vec.ll')
-rw-r--r-- | llvm/test/CodeGen/Mips/msa/vec.ll | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/test/CodeGen/Mips/msa/vec.ll b/llvm/test/CodeGen/Mips/msa/vec.ll index 3916c69498f..d5b97f52fb8 100644 --- a/llvm/test/CodeGen/Mips/msa/vec.ll +++ b/llvm/test/CodeGen/Mips/msa/vec.ll @@ -431,9 +431,9 @@ entry: ; ANYENDIAN-DAG: ld.b [[R4:\$w[0-9]+]], 0([[R1]]) ; ANYENDIAN-DAG: ld.b [[R5:\$w[0-9]+]], 0([[R2]]) ; ANYENDIAN-DAG: ld.b [[R6:\$w[0-9]+]], 0([[R3]]) -; bmnz.v is the same as bsel.v with wt and wd_in swapped -; ANYENDIAN-DAG: bmnz.v [[R6]], [[R5]], [[R4]] -; ANYENDIAN-DAG: st.b [[R6]], 0( +; bmnz.v is the same as bsel.v with (wd_in, wt, ws) -> (wt, ws, wd_in) +; ANYENDIAN-DAG: bmnz.v [[R5]], [[R6]], [[R4]] +; ANYENDIAN-DAG: st.b [[R5]], 0( ; ANYENDIAN: .size llvm_mips_bsel_v_b_test @llvm_mips_bsel_v_h_ARG1 = global <8 x i16> <i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7>, align 16 @@ -462,9 +462,9 @@ entry: ; ANYENDIAN-DAG: ld.b [[R4:\$w[0-9]+]], 0([[R1]]) ; ANYENDIAN-DAG: ld.b [[R5:\$w[0-9]+]], 0([[R2]]) ; ANYENDIAN-DAG: ld.b [[R6:\$w[0-9]+]], 0([[R3]]) -; bmnz.v is the same as bsel.v with wt and wd_in swapped -; ANYENDIAN-DAG: bmnz.v [[R6]], [[R5]], [[R4]] -; ANYENDIAN-DAG: st.b [[R6]], 0( +; bmnz.v is the same as bsel.v with (wd_in, wt, ws) -> (wt, ws, wd_in) +; ANYENDIAN-DAG: bmnz.v [[R5]], [[R6]], [[R4]] +; ANYENDIAN-DAG: st.b [[R5]], 0( ; ANYENDIAN: .size llvm_mips_bsel_v_h_test @llvm_mips_bsel_v_w_ARG1 = global <4 x i32> <i32 0, i32 1, i32 2, i32 3>, align 16 @@ -493,9 +493,9 @@ entry: ; ANYENDIAN-DAG: ld.b [[R4:\$w[0-9]+]], 0([[R1]]) ; ANYENDIAN-DAG: ld.b [[R5:\$w[0-9]+]], 0([[R2]]) ; ANYENDIAN-DAG: ld.b [[R6:\$w[0-9]+]], 0([[R3]]) -; bmnz.v is the same as bsel.v with wt and wd_in swapped -; ANYENDIAN-DAG: bmnz.v [[R6]], [[R5]], [[R4]] -; ANYENDIAN-DAG: st.b [[R6]], 0( +; bmnz.v is the same as bsel.v with (wd_in, wt, ws) -> (wt, ws, wd_in) +; ANYENDIAN-DAG: bmnz.v [[R5]], [[R6]], [[R4]] +; ANYENDIAN-DAG: st.b [[R5]], 0( ; ANYENDIAN: .size llvm_mips_bsel_v_w_test @llvm_mips_bsel_v_d_ARG1 = global <2 x i64> <i64 0, i64 1>, align 16 @@ -524,9 +524,9 @@ entry: ; ANYENDIAN-DAG: ld.b [[R4:\$w[0-9]+]], 0([[R1]]) ; ANYENDIAN-DAG: ld.b [[R5:\$w[0-9]+]], 0([[R2]]) ; ANYENDIAN-DAG: ld.b [[R6:\$w[0-9]+]], 0([[R3]]) -; bmnz.v is the same as bsel.v with wt and wd_in swapped -; ANYENDIAN-DAG: bmnz.v [[R6]], [[R5]], [[R4]] -; ANYENDIAN-DAG: st.b [[R6]], 0( +; bmnz.v is the same as bsel.v with (wd_in, wt, ws) -> (wt, ws, wd_in) +; ANYENDIAN-DAG: bmnz.v [[R5]], [[R6]], [[R4]] +; ANYENDIAN-DAG: st.b [[R5]], 0( ; ANYENDIAN: .size llvm_mips_bsel_v_d_test @llvm_mips_nor_v_b_ARG1 = global <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, align 16 |