1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/CodeGen/Mips/msa/nori.b.ll
Simon Atanasyan 70b90cb2d6 [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
2019-09-11 11:16:06 +00:00

27 lines
777 B
LLVM

; 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)