summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2014-05-22 11:55:04 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2014-05-22 11:55:04 +0000
commitb08e03806f019366da41c75173b9358106a22edc (patch)
tree33427fab68eba3385a3dc643aca53ad29f750076
parent98eba923346615a9b2896b5a1f2377def1b73c35 (diff)
downloadllvm-b08e03806f019366da41c75173b9358106a22edc.tar.gz
llvm-b08e03806f019366da41c75173b9358106a22edc.tar.bz2
llvm-b08e03806f019366da41c75173b9358106a22edc.tar.xz
[mips] Make unalignedload.ll test stricter and easier to modify for MIPS32r6/MIPS64r6
Summary: * Split into two functions, one to test each struct. * R0 and R2 must be defined by an lw with a %got reference to the correct symbol. * Test for $4 (first argument) where appropriate instead of accepting any register. * Test that the two lbu's are correctly combined into $4 Depends on D3844 Reviewers: jkolek, zoran.jovanovic, vmedic Reviewed By: vmedic Differential Revision: http://reviews.llvm.org/D3845 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209424 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CodeGen/Mips/unalignedload.ll41
1 files changed, 29 insertions, 12 deletions
diff --git a/test/CodeGen/Mips/unalignedload.ll b/test/CodeGen/Mips/unalignedload.ll
index 19f3af7f34..e86b1bae11 100644
--- a/test/CodeGen/Mips/unalignedload.ll
+++ b/test/CodeGen/Mips/unalignedload.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -march=mipsel | FileCheck %s -check-prefix=CHECK-EL
-; RUN: llc < %s -march=mips | FileCheck %s -check-prefix=CHECK-EB
+; RUN: llc < %s -march=mipsel | FileCheck %s -check-prefix=ALL -check-prefix=CHECK-EL
+; RUN: llc < %s -march=mips | FileCheck %s -check-prefix=ALL -check-prefix=CHECK-EB
%struct.S2 = type { %struct.S1, %struct.S1 }
%struct.S1 = type { i8, i8 }
%struct.S4 = type { [7 x i8] }
@@ -7,21 +7,38 @@
@s2 = common global %struct.S2 zeroinitializer, align 1
@s4 = common global %struct.S4 zeroinitializer, align 1
-define void @foo1() nounwind {
+define void @bar1() nounwind {
entry:
-; CHECK-EL-DAG: lbu ${{[0-9]+}}, 2($[[R0:[0-9]+]])
-; CHECK-EL-DAG: lbu ${{[0-9]+}}, 3($[[R0]])
-; CHECK-EL: jalr
-; CHECK-EL-DAG: lwl $[[R1:[0-9]+]], 3($[[R2:[0-9]+]])
+; ALL-LABEL: bar1:
+
+; ALL-DAG: lw $[[R0:[0-9]+]], %got(s2)(
+
+; ALL-DAG: lbu $[[PART1:[0-9]+]], 2($[[R0]])
+; ALL-DAG: lbu $[[PART2:[0-9]+]], 3($[[R0]])
+
+; CHECK-EL-DAG: sll $[[T0:[0-9]+]], $[[PART2]], 8
+; CHECK-EL-DAG: or $4, $[[T0]], $[[PART1]]
+
+; CHECK-EB-DAG: sll $[[T0:[0-9]+]], $[[PART1]], 8
+; CHECK-EB-DAG: or $[[T1:[0-9]+]], $[[T0]], $[[PART2]]
+; CHECK-EB-DAG: sll $4, $[[T1]], 16
+
+ tail call void @foo2(%struct.S1* byval getelementptr inbounds (%struct.S2* @s2, i32 0, i32 1)) nounwind
+ ret void
+}
+
+define void @bar2() nounwind {
+entry:
+; ALL-LABEL: bar2:
+
+; ALL-DAG: lw $[[R2:[0-9]+]], %got(s4)(
+
+; CHECK-EL-DAG: lwl $[[R1:4]], 3($[[R2]])
; CHECK-EL-DAG: lwr $[[R1]], 0($[[R2]])
-; CHECK-EB-DAG: lbu ${{[0-9]+}}, 3($[[R0:[0-9]+]])
-; CHECK-EB-DAG: lbu ${{[0-9]+}}, 2($[[R0]])
-; CHECK-EB: jalr
-; CHECK-EB-DAG: lwl $[[R1:[0-9]+]], 0($[[R2:[0-9]+]])
+; CHECK-EB-DAG: lwl $[[R1:4]], 0($[[R2]])
; CHECK-EB-DAG: lwr $[[R1]], 3($[[R2]])
- tail call void @foo2(%struct.S1* byval getelementptr inbounds (%struct.S2* @s2, i32 0, i32 1)) nounwind
tail call void @foo4(%struct.S4* byval @s4) nounwind
ret void
}