mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-04 01:11:44 +00:00
[mips][msa] Fix infinite loop for mips.nori.b intrinsic
When value of immediate in `mips.nori.b` is 255 (which has all ones in binary form as 8bit integer) DAGCombiner and Legalizer would fall in an infinite loop. DAGCombiner would try to simplify `or %value, -1` by turning `%value` into UNDEF. Legalizer will turn it back into `Constant<0>` which would then be again turned into UNDEF by DAGCombiner. To avoid this loop we make UNDEF legal for MSA int types on Mips. Patch by Mirko Brkusanin. Differential Revision: https://reviews.llvm.org/D67280 llvm-svn: 371607
This commit is contained in:
parent
d9a5aea9c0
commit
70b90cb2d6
@ -327,6 +327,7 @@ addMSAIntType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC) {
|
||||
setOperationAction(ISD::EXTRACT_VECTOR_ELT, Ty, Custom);
|
||||
setOperationAction(ISD::INSERT_VECTOR_ELT, Ty, Legal);
|
||||
setOperationAction(ISD::BUILD_VECTOR, Ty, Custom);
|
||||
setOperationAction(ISD::UNDEF, Ty, Legal);
|
||||
|
||||
setOperationAction(ISD::ADD, Ty, Legal);
|
||||
setOperationAction(ISD::AND, Ty, Legal);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -86,9 +86,8 @@ declare <2 x i64> @llvm.mips.fill.d(i64) nounwind
|
||||
; MIPS-ANY: llvm_mips_fill_d_test:
|
||||
; MIPS32-DAG: lw [[R1:\$[0-9]+]], 0(
|
||||
; MIPS32-DAG: lw [[R2:\$[0-9]+]], 4(
|
||||
; MIPS64-DAG: ld [[R1:\$[0-9]+]], %got_disp(llvm_mips_fill_d_ARG1)
|
||||
; MIPS32-DAG: ldi.b [[R3:\$w[0-9]+]], 0
|
||||
; MIPS32-DAG: insert.w [[R3]][0], [[R1]]
|
||||
; MIPS64-DAG: ld [[R1]], %got_disp(llvm_mips_fill_d_ARG1)
|
||||
; MIPS32-DAG: insert.w [[R3:\$w[0-9]+]][0], [[R1]]
|
||||
; MIPS32-DAG: insert.w [[R3]][1], [[R2]]
|
||||
; MIPS32-DAG: insert.w [[R3]][2], [[R1]]
|
||||
; MIPS32-DAG: insert.w [[R3]][3], [[R2]]
|
||||
|
26
test/CodeGen/Mips/msa/nori.b.ll
Normal file
26
test/CodeGen/Mips/msa/nori.b.ll
Normal file
@ -0,0 +1,26 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc -march=mips64el -mcpu=mips64r6 -mattr=+msa,+fp64 < %s | FileCheck %s
|
||||
|
||||
; Test that simply checks if it will finish when value 255 (-1) appears as
|
||||
; immediate in 'nori.b' instruction.
|
||||
|
||||
; mips.nori.b %dst, %a, imm
|
||||
; mips.nori.b %dst, %a, -1
|
||||
; %dst = not (or %a, -1)
|
||||
; %dst = xor (or %a, -1), -1
|
||||
; %dst = xor -1, -1
|
||||
; %dst = 0
|
||||
|
||||
define <16 x i8> @foo(<16 x i8> %a) {
|
||||
; CHECK-LABEL: foo:
|
||||
; CHECK: # %bb.0: # %bb2
|
||||
; CHECK-NEXT: ldi.b $w0, 0
|
||||
; CHECK-NEXT: copy_s.d $2, $w0[0]
|
||||
; CHECK-NEXT: jr $ra
|
||||
; CHECK-NEXT: copy_s.d $3, $w0[1]
|
||||
bb2:
|
||||
%0 = tail call <16 x i8> @llvm.mips.nori.b(<16 x i8> %a, i32 255)
|
||||
ret <16 x i8> %0
|
||||
}
|
||||
|
||||
declare <16 x i8> @llvm.mips.nori.b(<16 x i8>, i32)
|
Loading…
Reference in New Issue
Block a user