From 118eb5894e448dfddc0152f8f28284315b6f955e Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Fri, 30 Aug 2013 02:43:08 +0000 Subject: [PATCH] [PowerPC] Miscellaneous fast-isel test cases. Here are a few more tests that now pass after the recent fast-isel commits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189637 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../CodeGen/PowerPC/fast-isel-GEP-coalesce.ll | 48 ++++++++++++++++++ test/CodeGen/PowerPC/fast-isel-crash.ll | 23 +++++++++ .../CodeGen/PowerPC/fast-isel-redefinition.ll | 10 ++++ test/CodeGen/PowerPC/fast-isel-shifter.ll | 50 +++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 test/CodeGen/PowerPC/fast-isel-GEP-coalesce.ll create mode 100644 test/CodeGen/PowerPC/fast-isel-crash.ll create mode 100644 test/CodeGen/PowerPC/fast-isel-redefinition.ll create mode 100644 test/CodeGen/PowerPC/fast-isel-shifter.ll diff --git a/test/CodeGen/PowerPC/fast-isel-GEP-coalesce.ll b/test/CodeGen/PowerPC/fast-isel-GEP-coalesce.ll new file mode 100644 index 00000000000..7bdda0494b8 --- /dev/null +++ b/test/CodeGen/PowerPC/fast-isel-GEP-coalesce.ll @@ -0,0 +1,48 @@ +; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=ELF64 + +%struct.A = type { i32, [2 x [2 x i32]], i8, [3 x [3 x [3 x i32]]] } +%struct.B = type { i32, [2 x [2 x [2 x %struct.A]]] } + +@arr = common global [2 x [2 x [2 x [2 x [2 x i32]]]]] zeroinitializer, align 4 +@A = common global [3 x [3 x %struct.A]] zeroinitializer, align 4 +@B = common global [2 x [2 x [2 x %struct.B]]] zeroinitializer, align 4 + +define i32* @t1() nounwind { +entry: +; ELF64: t1 + %addr = alloca i32*, align 4 + store i32* getelementptr inbounds ([2 x [2 x [2 x [2 x [2 x i32]]]]]* @arr, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1), i32** %addr, align 4 +; ELF64: addi {{[0-9]+}}, {{[0-9]+}}, 124 + %0 = load i32** %addr, align 4 + ret i32* %0 +} + +define i32* @t2() nounwind { +entry: +; ELF64: t2 + %addr = alloca i32*, align 4 + store i32* getelementptr inbounds ([3 x [3 x %struct.A]]* @A, i32 0, i32 2, i32 2, i32 3, i32 1, i32 2, i32 2), i32** %addr, align 4 +; ELF64: addi {{[0-9]+}}, {{[0-9]+}}, 1148 + %0 = load i32** %addr, align 4 + ret i32* %0 +} + +define i32* @t3() nounwind { +entry: +; ELF64: t3 + %addr = alloca i32*, align 4 + store i32* getelementptr inbounds ([3 x [3 x %struct.A]]* @A, i32 0, i32 0, i32 1, i32 1, i32 0, i32 1), i32** %addr, align 4 +; ELF64: addi {{[0-9]+}}, {{[0-9]+}}, 140 + %0 = load i32** %addr, align 4 + ret i32* %0 +} + +define i32* @t4() nounwind { +entry: +; ELF64: t4 + %addr = alloca i32*, align 4 + store i32* getelementptr inbounds ([2 x [2 x [2 x %struct.B]]]* @B, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 3, i32 1, i32 2, i32 1), i32** %addr, align 4 +; ELF64: addi {{[0-9]+}}, {{[0-9]+}}, 1284 + %0 = load i32** %addr, align 4 + ret i32* %0 +} diff --git a/test/CodeGen/PowerPC/fast-isel-crash.ll b/test/CodeGen/PowerPC/fast-isel-crash.ll new file mode 100644 index 00000000000..1813fc96ace --- /dev/null +++ b/test/CodeGen/PowerPC/fast-isel-crash.ll @@ -0,0 +1,23 @@ +; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 + +; Ensure this doesn't crash. + +%union.anon = type { <16 x i32> } + +@__md0 = external global [137 x i8] + +define internal void @stretch(<4 x i8> addrspace(1)* %src, <4 x i8> addrspace(1)* %dst, i32 %width, i32 %height, i32 %iLS, i32 %oLS, <2 x float> %c, <4 x float> %param) nounwind { +entry: + ret void +} + +define internal i32 @_Z13get_global_idj(i32 %dim) nounwind ssp { +entry: + ret i32 undef +} + +define void @wrap(i8 addrspace(1)* addrspace(1)* %arglist, i32 addrspace(1)* %gtid) nounwind ssp { +entry: + call void @stretch(<4 x i8> addrspace(1)* undef, <4 x i8> addrspace(1)* undef, i32 undef, i32 undef, i32 undef, i32 undef, <2 x float> undef, <4 x float> undef) + ret void +} diff --git a/test/CodeGen/PowerPC/fast-isel-redefinition.ll b/test/CodeGen/PowerPC/fast-isel-redefinition.ll new file mode 100644 index 00000000000..72422bda443 --- /dev/null +++ b/test/CodeGen/PowerPC/fast-isel-redefinition.ll @@ -0,0 +1,10 @@ +; RUN: llc -O0 -verify-machineinstrs -fast-isel-abort -optimize-regalloc -regalloc=basic -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 < %s +; This isn't exactly a useful set of command-line options, but check that it +; doesn't crash. (It crashed formerly on ARM, and proved useful in +; discovering a bug on PowerPC as well.) + +define i32 @f(i32* %x) nounwind ssp { + %y = getelementptr inbounds i32* %x, i32 5000 + %tmp103 = load i32* %y, align 4 + ret i32 %tmp103 +} diff --git a/test/CodeGen/PowerPC/fast-isel-shifter.ll b/test/CodeGen/PowerPC/fast-isel-shifter.ll new file mode 100644 index 00000000000..198bfbecda6 --- /dev/null +++ b/test/CodeGen/PowerPC/fast-isel-shifter.ll @@ -0,0 +1,50 @@ +; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=ELF64 + +define i32 @shl() nounwind ssp { +entry: +; ELF64: shl +; ELF64: slw + %shl = shl i32 -1, 2 + ret i32 %shl +} + +define i32 @shl_reg(i32 %src1, i32 %src2) nounwind ssp { +entry: +; ELF64: shl_reg +; ELF64: slw + %shl = shl i32 %src1, %src2 + ret i32 %shl +} + +define i32 @lshr() nounwind ssp { +entry: +; ELF64: lshr +; ELF64: srw + %lshr = lshr i32 -1, 2 + ret i32 %lshr +} + +define i32 @lshr_reg(i32 %src1, i32 %src2) nounwind ssp { +entry: +; ELF64: lshr_reg +; ELF64: srw + %lshr = lshr i32 %src1, %src2 + ret i32 %lshr +} + +define i32 @ashr() nounwind ssp { +entry: +; ELF64: ashr +; ELF64: srawi + %ashr = ashr i32 -1, 2 + ret i32 %ashr +} + +define i32 @ashr_reg(i32 %src1, i32 %src2) nounwind ssp { +entry: +; ELF64: ashr_reg +; ELF64: sraw + %ashr = ashr i32 %src1, %src2 + ret i32 %ashr +} + -- 2.34.1