mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-24 06:30:19 +00:00
b76f5ba103
Currently the VSX support enables use of lxvd2x and stxvd2x for 2x64 types, but does not yet use lxvw4x and stxvw4x for 4x32 types. This patch adds that support. As with lxvd2x/stxvd2x, this involves straightforward overriding of the patterns normally recognized for lvx/stvx, with preference given to the VSX patterns when VSX is enabled. In addition, the logic for permitting misaligned memory accesses is modified so that v4r32 and v4i32 are treated the same as v2f64 and v2i64 when VSX is enabled. Finally, the DAG generation for unaligned loads is changed to just use a normal LOAD (which will become lxvw4x) on P8 and later hardware, where unaligned loads are preferred over lvsl/lvx/lvx/vperm. A number of tests now generate the VSX loads/stores instead of lvx/stvx, so this patch adds VSX variants to those tests. I've also added <4 x float> tests to the vsx.ll test case, and created a vsx-p8.ll test case to be used for testing code generation for the P8Vector feature. For now, that simply tests the unaligned load/store behavior. This has been tested along with a temporary patch to enable the VSX and P8Vector features, with no new regressions encountered with or without the temporary patch applied. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220047 91177308-0d34-0410-b5e6-96231b3b80d8
80 lines
2.5 KiB
LLVM
80 lines
2.5 KiB
LLVM
; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx < %s | FileCheck %s
|
|
; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=+vsx < %s | FileCheck -check-prefix=CHECK-VSX %s
|
|
target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
|
|
target triple = "powerpc64-unknown-linux-gnu"
|
|
|
|
%struct.s2 = type { i64, <4 x float> }
|
|
|
|
@ve = external global <4 x float>
|
|
@n = external global i64
|
|
|
|
; Function Attrs: nounwind
|
|
define void @test1(i64 %d1, i64 %d2, i64 %d3, i64 %d4, i64 %d5, i64 %d6, i64 %d7, i64 %d8, i64 %d9, <4 x float> inreg %vs.coerce) #0 {
|
|
entry:
|
|
store <4 x float> %vs.coerce, <4 x float>* @ve, align 16
|
|
ret void
|
|
|
|
; CHECK-LABEL: @test1
|
|
; CHECK: stvx 2,
|
|
; CHECK: blr
|
|
|
|
; CHECK-VSX-LABEL: @test1
|
|
; CHECK-VSX: stxvw4x 34,
|
|
; CHECK-VSX: blr
|
|
}
|
|
|
|
; Function Attrs: nounwind
|
|
define void @test2(i64 %d1, i64 %d2, i64 %d3, i64 %d4, i64 %d5, i64 %d6, i64 %d7, i64 %d8, %struct.s2* byval nocapture readonly %vs) #0 {
|
|
entry:
|
|
%m = getelementptr inbounds %struct.s2* %vs, i64 0, i32 0
|
|
%0 = load i64* %m, align 8
|
|
store i64 %0, i64* @n, align 8
|
|
%v = getelementptr inbounds %struct.s2* %vs, i64 0, i32 1
|
|
%1 = load <4 x float>* %v, align 16
|
|
store <4 x float> %1, <4 x float>* @ve, align 16
|
|
ret void
|
|
|
|
; CHECK-LABEL: @test2
|
|
; CHECK: ld {{[0-9]+}}, 112(1)
|
|
; CHECK: li [[REG16:[0-9]+]], 16
|
|
; CHECK: addi [[REGB:[0-9]+]], 1, 112
|
|
; CHECK: lvx 2, [[REGB]], [[REG16]]
|
|
; CHECK: blr
|
|
|
|
; CHECK-VSX-LABEL: @test2
|
|
; CHECK-VSX: ld {{[0-9]+}}, 112(1)
|
|
; CHECK-VSX: li [[REG16:[0-9]+]], 16
|
|
; CHECK-VSX: addi [[REGB:[0-9]+]], 1, 112
|
|
; CHECK-VSX: lxvw4x {{[0-9]+}}, [[REGB]], [[REG16]]
|
|
; CHECK-VSX: blr
|
|
}
|
|
|
|
; Function Attrs: nounwind
|
|
define void @test3(i64 %d1, i64 %d2, i64 %d3, i64 %d4, i64 %d5, i64 %d6, i64 %d7, i64 %d8, i64 %d9, %struct.s2* byval nocapture readonly %vs) #0 {
|
|
entry:
|
|
%m = getelementptr inbounds %struct.s2* %vs, i64 0, i32 0
|
|
%0 = load i64* %m, align 8
|
|
store i64 %0, i64* @n, align 8
|
|
%v = getelementptr inbounds %struct.s2* %vs, i64 0, i32 1
|
|
%1 = load <4 x float>* %v, align 16
|
|
store <4 x float> %1, <4 x float>* @ve, align 16
|
|
ret void
|
|
|
|
; CHECK-LABEL: @test3
|
|
; CHECK: ld {{[0-9]+}}, 128(1)
|
|
; CHECK: li [[REG16:[0-9]+]], 16
|
|
; CHECK: addi [[REGB:[0-9]+]], 1, 128
|
|
; CHECK: lvx 2, [[REGB]], [[REG16]]
|
|
; CHECK: blr
|
|
|
|
; CHECK-VSX-LABEL: @test3
|
|
; CHECK-VSX: ld {{[0-9]+}}, 128(1)
|
|
; CHECK-VSX: li [[REG16:[0-9]+]], 16
|
|
; CHECK-VSX: addi [[REGB:[0-9]+]], 1, 128
|
|
; CHECK-VSX: lxvw4x {{[0-9]+}}, [[REGB]], [[REG16]]
|
|
; CHECK-VSX: blr
|
|
}
|
|
|
|
attributes #0 = { nounwind }
|
|
|