From 26f61a158b3cce69252c05cc0e79f500d6c3d92e Mon Sep 17 00:00:00 2001 From: Sirish Pande Date: Thu, 3 May 2012 21:52:53 +0000 Subject: Support for target dependent Hexagon VLIW packetizer. This patch creates and optimizes packets as per Hexagon ISA rules. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156109 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/Hexagon/dualstore.ll | 17 +++++++++++++++++ test/CodeGen/Hexagon/fusedandshift.ll | 16 ++++++++++++++++ test/CodeGen/Hexagon/macint.ll | 14 ++++++++++++++ test/CodeGen/Hexagon/newvaluestore.ll | 22 ++++++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 test/CodeGen/Hexagon/dualstore.ll create mode 100644 test/CodeGen/Hexagon/fusedandshift.ll create mode 100644 test/CodeGen/Hexagon/macint.ll create mode 100644 test/CodeGen/Hexagon/newvaluestore.ll (limited to 'test/CodeGen/Hexagon') diff --git a/test/CodeGen/Hexagon/dualstore.ll b/test/CodeGen/Hexagon/dualstore.ll new file mode 100644 index 0000000000..9b27dda52c --- /dev/null +++ b/test/CodeGen/Hexagon/dualstore.ll @@ -0,0 +1,17 @@ +; RUN: llc -march=hexagon -mcpu=hexagonv4 < %s | FileCheck %s +; Check that we generate dual stores in one packet in V4 + +; CHECK: memw(r{{[0-9]+}} + #{{[0-9]+}}) = r{{[0-9]+}} +; CHECK-NEXT: memw(r{{[0-9]+}} + #{{[0-9]+}}) = r{{[0-9]+}} +; CHECK-NEXT: } + +@Reg = global i32 0, align 4 +define i32 @main() nounwind { +entry: + %number= alloca i32, align 4 + store i32 500000, i32* %number, align 4 + %number1= alloca i32, align 4 + store i32 100000, i32* %number1, align 4 + ret i32 0 +} + diff --git a/test/CodeGen/Hexagon/fusedandshift.ll b/test/CodeGen/Hexagon/fusedandshift.ll new file mode 100644 index 0000000000..022b3c6734 --- /dev/null +++ b/test/CodeGen/Hexagon/fusedandshift.ll @@ -0,0 +1,16 @@ +; RUN: llc -march=hexagon -mcpu=hexagonv4 < %s | FileCheck %s +; Check that we generate fused logical and with shift instruction. + +; CHECK: r{{[0-9]+}} = and(#15, lsr(r{{[0-9]+}}, #{{[0-9]+}}) + +define i32 @main(i16* %a, i16* %b) nounwind { + entry: + %0 = load i16* %a, align 2 + %conv1 = sext i16 %0 to i32 + %shr1 = ashr i32 %conv1, 3 + %and1 = and i32 %shr1, 15 + %conv2 = trunc i32 %and1 to i16 + store i16 %conv2, i16* %b, align 2 + ret i32 0 +} + diff --git a/test/CodeGen/Hexagon/macint.ll b/test/CodeGen/Hexagon/macint.ll new file mode 100644 index 0000000000..b3b9d0ee7a --- /dev/null +++ b/test/CodeGen/Hexagon/macint.ll @@ -0,0 +1,14 @@ +; RUN: llc -march=hexagon -mcpu=hexagonv4 < %s | FileCheck %s +; Check that we generate integer multiply accumulate. + +; CHECK: r{{[0-9]+}} += mpyi(r{{[0-9]+}}, r{{[0-9]+}}) + +define i32 @main(i32* %a, i32* %b) nounwind { + entry: + %0 = load i32* %a, align 4 + %div = udiv i32 %0, 10000 + %rem = urem i32 %div, 10 + store i32 %rem, i32* %b, align 4 + ret i32 0 +} + diff --git a/test/CodeGen/Hexagon/newvaluestore.ll b/test/CodeGen/Hexagon/newvaluestore.ll new file mode 100644 index 0000000000..ab69b22df5 --- /dev/null +++ b/test/CodeGen/Hexagon/newvaluestore.ll @@ -0,0 +1,22 @@ +; RUN: llc -march=hexagon -mcpu=hexagonv4 < %s | FileCheck %s +; Check that we generate new value store packet in V4 + +@i = global i32 0, align 4 +@j = global i32 10, align 4 +@k = global i32 100, align 4 + +define i32 @main() nounwind { +entry: +; CHECK: memw(r{{[0-9]+}} + #{{[0-9]+}}) = r{{[0-9]+}}.new + %number1 = alloca i32, align 4 + %number2 = alloca i32, align 4 + %number3 = alloca i32, align 4 + %0 = load i32 * @i, align 4 + store i32 %0, i32* %number1, align 4 + %1 = load i32 * @j, align 4 + store i32 %1, i32* %number2, align 4 + %2 = load i32 * @k, align 4 + store i32 %2, i32* %number3, align 4 + ret i32 %0 +} + -- cgit v1.2.3