1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/Transforms/PhaseOrdering/vector-trunc-inseltpoison.ll
Juneyoung Lee 08ec5d7c6b Precommit transform tests that have poison as insertelement's placeholder
This commit copies existing tests at llvm/Transforms and replaces
'insertelement undef' in those files with 'insertelement poison'.
(see https://reviews.llvm.org/D93586)

Tests listed using this script:

grep -R -E '^[^;]*insertelement <.*> undef,' . | cut -d":" -f1 | uniq |
wc -l

Tests updated:

file_org=llvm/test/Transforms/$1
file=${file_org%.ll}-inseltpoison.ll
cp $file_org $file
sed -i -E 's/^([^;]*)insertelement <(.*)> undef/\1insertelement <\2> poison/g' $file
head -1 $file | grep "Assertions have been autogenerated by utils/update_test_checks.py" -q
if [ "$?" == 1 ]; then
  echo "$file : should be manually updated"
  # I manually updated the script
  exit 1
fi
python3 ./llvm/utils/update_test_checks.py --opt-binary=./build-releaseassert/bin/opt $file
2020-12-24 11:46:17 +09:00

24 lines
920 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -O2 -S -data-layout="e" < %s | FileCheck %s
; RUN: opt -passes='default<O2>' -S -data-layout="e" < %s | FileCheck %s
define <4 x i16> @truncate(<4 x i32> %x) {
; CHECK-LABEL: @truncate(
; CHECK-NEXT: [[V3:%.*]] = trunc <4 x i32> [[X:%.*]] to <4 x i16>
; CHECK-NEXT: ret <4 x i16> [[V3]]
;
%x0 = extractelement <4 x i32> %x, i32 0
%t0 = trunc i32 %x0 to i16
%v0 = insertelement <4 x i16> poison, i16 %t0, i32 0
%x1 = extractelement <4 x i32> %x, i32 1
%t1 = trunc i32 %x1 to i16
%v1 = insertelement <4 x i16> %v0, i16 %t1, i32 1
%x2 = extractelement <4 x i32> %x, i32 2
%t2 = trunc i32 %x2 to i16
%v2 = insertelement <4 x i16> %v1, i16 %t2, i32 2
%x3 = extractelement <4 x i32> %x, i32 3
%t3 = trunc i32 %x3 to i16
%v3 = insertelement <4 x i16> %v2, i16 %t3, i32 3
ret <4 x i16> %v3
}