mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
7e0334d096
When lowering a load or store for TypeWidenVector, the type legalizer would use a single load or store if the associated integer type was legal. E.g. it would load a v4i8 as an i32 if i32 was legal. This patch extends that behavior to promoted integers as well as legal ones. If the integer type for the full vector width is TypePromoteInteger, the element type is going to be TypePromoteInteger too, and it's still better to use a single promoting load or truncating store rather than N individual promoting loads or truncating stores. E.g. if you have a v2i8 on a target where i16 is promoted to i32, it's better to load the v2i8 as an i16 rather than load both i8s individually. Original patch by Richard Sandiford. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236528 91177308-0d34-0410-b5e6-96231b3b80d8
105 lines
2.8 KiB
LLVM
105 lines
2.8 KiB
LLVM
; Test vector truncating stores.
|
|
;
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
|
|
|
|
; Test a v16i8->v16i1 truncation.
|
|
define void @f1(<16 x i8> %val, <16 x i1> *%ptr) {
|
|
; No expected output, but must compile.
|
|
%trunc = trunc <16 x i8> %val to <16 x i1>
|
|
store <16 x i1> %trunc, <16 x i1> *%ptr
|
|
ret void
|
|
}
|
|
|
|
; Test a v8i16->v8i1 truncation.
|
|
define void @f2(<8 x i16> %val, <8 x i1> *%ptr) {
|
|
; No expected output, but must compile.
|
|
%trunc = trunc <8 x i16> %val to <8 x i1>
|
|
store <8 x i1> %trunc, <8 x i1> *%ptr
|
|
ret void
|
|
}
|
|
|
|
; Test a v8i16->v8i8 truncation.
|
|
define void @f3(<8 x i16> %val, <8 x i8> *%ptr) {
|
|
; CHECK-LABEL: f3:
|
|
; CHECK: vpkh [[REG1:%v[0-9]+]], %v24, %v24
|
|
; CHECK: vsteg [[REG1]], 0(%r2)
|
|
; CHECK: br %r14
|
|
%trunc = trunc <8 x i16> %val to <8 x i8>
|
|
store <8 x i8> %trunc, <8 x i8> *%ptr
|
|
ret void
|
|
}
|
|
|
|
; Test a v4i32->v4i1 truncation.
|
|
define void @f4(<4 x i32> %val, <4 x i1> *%ptr) {
|
|
; No expected output, but must compile.
|
|
%trunc = trunc <4 x i32> %val to <4 x i1>
|
|
store <4 x i1> %trunc, <4 x i1> *%ptr
|
|
ret void
|
|
}
|
|
|
|
; Test a v4i32->v4i8 truncation. At the moment we use a VPERM rather than
|
|
; a chain of packs.
|
|
define void @f5(<4 x i32> %val, <4 x i8> *%ptr) {
|
|
; CHECK-LABEL: f5:
|
|
; CHECK: vperm [[REG:%v[0-9]+]],
|
|
; CHECK: vstef [[REG]], 0(%r2)
|
|
; CHECK: br %r14
|
|
%trunc = trunc <4 x i32> %val to <4 x i8>
|
|
store <4 x i8> %trunc, <4 x i8> *%ptr
|
|
ret void
|
|
}
|
|
|
|
; Test a v4i32->v4i16 truncation.
|
|
define void @f6(<4 x i32> %val, <4 x i16> *%ptr) {
|
|
; CHECK-LABEL: f6:
|
|
; CHECK: vpkf [[REG1:%v[0-9]+]], %v24, %v24
|
|
; CHECK: vsteg [[REG1]], 0(%r2)
|
|
; CHECK: br %r14
|
|
%trunc = trunc <4 x i32> %val to <4 x i16>
|
|
store <4 x i16> %trunc, <4 x i16> *%ptr
|
|
ret void
|
|
}
|
|
|
|
; Test a v2i64->v2i1 truncation.
|
|
define void @f7(<2 x i64> %val, <2 x i1> *%ptr) {
|
|
; No expected output, but must compile.
|
|
%trunc = trunc <2 x i64> %val to <2 x i1>
|
|
store <2 x i1> %trunc, <2 x i1> *%ptr
|
|
ret void
|
|
}
|
|
|
|
; Test a v2i64->v2i8 truncation. At the moment we use a VPERM rather than
|
|
; a chain of packs.
|
|
define void @f8(<2 x i64> %val, <2 x i8> *%ptr) {
|
|
; CHECK-LABEL: f8:
|
|
; CHECK: vperm [[REG:%v[0-9]+]],
|
|
; CHECK: vsteh [[REG]], 0(%r2)
|
|
; CHECK: br %r14
|
|
%trunc = trunc <2 x i64> %val to <2 x i8>
|
|
store <2 x i8> %trunc, <2 x i8> *%ptr
|
|
ret void
|
|
}
|
|
|
|
; Test a v2i64->v2i16 truncation. At the moment we use a VPERM rather than
|
|
; a chain of packs.
|
|
define void @f9(<2 x i64> %val, <2 x i16> *%ptr) {
|
|
; CHECK-LABEL: f9:
|
|
; CHECK: vperm [[REG:%v[0-9]+]],
|
|
; CHECK: vstef [[REG]], 0(%r2)
|
|
; CHECK: br %r14
|
|
%trunc = trunc <2 x i64> %val to <2 x i16>
|
|
store <2 x i16> %trunc, <2 x i16> *%ptr
|
|
ret void
|
|
}
|
|
|
|
; Test a v2i64->v2i32 truncation.
|
|
define void @f10(<2 x i64> %val, <2 x i32> *%ptr) {
|
|
; CHECK-LABEL: f10:
|
|
; CHECK: vpkg [[REG1:%v[0-9]+]], %v24, %v24
|
|
; CHECK: vsteg [[REG1]], 0(%r2)
|
|
; CHECK: br %r14
|
|
%trunc = trunc <2 x i64> %val to <2 x i32>
|
|
store <2 x i32> %trunc, <2 x i32> *%ptr
|
|
ret void
|
|
}
|