From 333bbfc0c5a022cecfee9256bb104728297bd6c8 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Fri, 13 Nov 2015 01:46:06 +0000 Subject: [PATCH] [Hexagon] NFC. Adding a number of packet correctness tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253000 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/MC/Hexagon/capitalizedEndloop.s | 29 ++++++++++++++++++++++++++++ test/MC/Hexagon/dcfetch.s | 15 ++++++++++++++ test/MC/Hexagon/empty_asm.s | 15 ++++++++++++++ test/MC/Hexagon/endloop.s | 19 ++++++++++++++++++ test/MC/Hexagon/relaxed_newvalue.s | 10 ++++++++++ 5 files changed, 88 insertions(+) create mode 100644 test/MC/Hexagon/capitalizedEndloop.s create mode 100644 test/MC/Hexagon/dcfetch.s create mode 100644 test/MC/Hexagon/empty_asm.s create mode 100644 test/MC/Hexagon/endloop.s create mode 100644 test/MC/Hexagon/relaxed_newvalue.s diff --git a/test/MC/Hexagon/capitalizedEndloop.s b/test/MC/Hexagon/capitalizedEndloop.s new file mode 100644 index 00000000000..d20ff34de6f --- /dev/null +++ b/test/MC/Hexagon/capitalizedEndloop.s @@ -0,0 +1,29 @@ +# RUN: llvm-mc -triple=hexagon -filetype=obj %s | llvm-objdump -d -r - | FileCheck %s +# + +# Verify that capitaizled endloops work + + { R0 = mpyi(R0,R0) } : endloop0 + { R0 = mpyi(R0,R0) } : ENDLOOP0 + { R0 = mpyi(R0,R0) }:endloop0 + + { R0 = mpyi(R0,R0) } : endloop1 + { R0 = mpyi(R0,R0) } : ENDLOOP1 + { R0 = mpyi(R0,R0) }:endloop1 + + { R0 = mpyi(R0,R0) } : endloop0 : endloop1 + { R0 = mpyi(R0,R0) } : ENDLOOP0 : ENDLOOP1 + { R0 = mpyi(R0,R0) }:endloop0:endloop1 + +# CHECK: r0 = mpyi(r0, r0) +# CHECK: :endloop0 +# CHECK: :endloop0 +# CHECK: :endloop0 +# CHECK: :endloop1 +# CHECK: :endloop1 +# CHECK: :endloop1 +# CHECK: :endloop0 :endloop1 +# CHECK: :endloop0 :endloop1 +# CHECK: :endloop0 :endloop1 + + diff --git a/test/MC/Hexagon/dcfetch.s b/test/MC/Hexagon/dcfetch.s new file mode 100644 index 00000000000..bf4349d95c3 --- /dev/null +++ b/test/MC/Hexagon/dcfetch.s @@ -0,0 +1,15 @@ +# RUN: llvm-mc -triple=hexagon -filetype=obj -mno-pairing %s -o %t; llvm-objdump -d %t | FileCheck %s + +# Check that DCFETCH is correctly shuffled. + + { dcfetch(r2 + #0); r1 = memw(r2) } +# CHECK: 9402c000 + +# Bug 17424: This should be a legal packet +{ + P3 = SP1LOOP0(#8,R18) + R7:6 = MEMUBH(R4++#4) + R13:12 = VALIGNB(R11:10,R9:8,P2) + DCFETCH(R5+#(8+0)) +} +# CHECK-NOT: error: diff --git a/test/MC/Hexagon/empty_asm.s b/test/MC/Hexagon/empty_asm.s new file mode 100644 index 00000000000..10b30ff558e --- /dev/null +++ b/test/MC/Hexagon/empty_asm.s @@ -0,0 +1,15 @@ +# RUN: llvm-mc -triple=hexagon -filetype=asm %s -o - | FileCheck %s + +# Verify empty packets aren't printed +barrier +{} +barrier +# CHECK: { +# CHECK-NEXT: barrier +# CHECK-NEXT: } +# CHECK-NOT: } +# CHECK: { +# CHECK-NEXT: barrier +# CHECK-NEXT: } + + diff --git a/test/MC/Hexagon/endloop.s b/test/MC/Hexagon/endloop.s new file mode 100644 index 00000000000..303f84fb14f --- /dev/null +++ b/test/MC/Hexagon/endloop.s @@ -0,0 +1,19 @@ +# RUN: llvm-mc -triple=hexagon -filetype=asm %s 2>%t; FileCheck %s <%t + +# Check that a branch in an end-loop packet is caught. + +1: +{ + r0 = #1 + p0 = cmp.eq (r1, r2) + if (p0) jump 1b +}:endloop0 + +2: +{ + r0 = #1 + p0 = cmp.eq (r1, r2) + if (p0) jump 2b +}:endloop1 + +# CHECK: rror: packet marked with `:endloop{{.}}' cannot contain instructions that modify register diff --git a/test/MC/Hexagon/relaxed_newvalue.s b/test/MC/Hexagon/relaxed_newvalue.s new file mode 100644 index 00000000000..65fbd312e0a --- /dev/null +++ b/test/MC/Hexagon/relaxed_newvalue.s @@ -0,0 +1,10 @@ +# RUN: llvm-mc -triple=hexagon -filetype=obj %s | llvm-objdump -d - | FileCheck %s +# Make sure relaxation doesn't hinder newvalue calculation + +#CHECK: r18 = add(r2, #-6) +#CHECK-NEXT: immext(#0) +#CHECK-NEXT: if (!cmp.gt(r18.new, #1)) jump:t +{ + r18 = add(r2, #-6) + if (!cmp.gt(r18.new, #1)) jump:t .unknown +} -- 2.34.1