llvm-6502/test/CodeGen/SystemZ/vec-extract-02.ll
Ulrich Weigand 97dbeaa8d5 [DAGCombiner] Account for getVectorIdxTy() when narrowing vector load
This patch makes ReplaceExtractVectorEltOfLoadWithNarrowedLoad convert
the element number from getVectorIdxTy() to PtrTy before doing pointer
arithmetic on it.  This is needed on z, where element numbers are i32
but pointers are i64.

Original patch by Richard Sandiford.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236530 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-05 19:34:10 +00:00

16 lines
503 B
LLVM

; Verify ReplaceExtractVectorEltOfLoadWithNarrowedLoad fixes
;
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
; Test a case where a vector extraction can be simplified to a scalar load.
; The index must be extended from i32 to i64.
define i32 @f1(<4 x i32> *%ptr, i32 %index) {
; CHECK-LABEL: f1:
; CHECK: risbg {{%r[0-5]}}, %r3, 30, 189, 2
; CHECK: l %r2,
; CHECK: br %r14
%vec = load <4 x i32>, <4 x i32> *%ptr
%res = extractelement <4 x i32> %vec, i32 %index
ret i32 %res
}