diff options
| author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2017-02-28 23:27:33 +0000 |
|---|---|---|
| committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2017-02-28 23:27:33 +0000 |
| commit | 33fd0bbbe8b2d5dd98964877d4f4344633e3197b (patch) | |
| tree | da6fbf76ecd627706ab25096f734a558d1311c4b /llvm/test/CodeGen/Hexagon | |
| parent | 41e7a27811045236d90c23900a4c808761b46f38 (diff) | |
| download | bcm5719-llvm-33fd0bbbe8b2d5dd98964877d4f4344633e3197b.tar.gz bcm5719-llvm-33fd0bbbe8b2d5dd98964877d4f4344633e3197b.zip | |
[Hexagon] Generate extract instructions more aggressively
llvm-svn: 296537
Diffstat (limited to 'llvm/test/CodeGen/Hexagon')
| -rw-r--r-- | llvm/test/CodeGen/Hexagon/bit-extract.ll | 75 | ||||
| -rw-r--r-- | llvm/test/CodeGen/Hexagon/bit-validate-reg.ll | 5 | ||||
| -rw-r--r-- | llvm/test/CodeGen/Hexagon/fusedandshift.ll | 2 | ||||
| -rw-r--r-- | llvm/test/CodeGen/Hexagon/vect/vect-shuffle.ll | 2 |
4 files changed, 81 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/Hexagon/bit-extract.ll b/llvm/test/CodeGen/Hexagon/bit-extract.ll new file mode 100644 index 00000000000..ad7d05d2c23 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/bit-extract.ll @@ -0,0 +1,75 @@ +; RUN: llc -march=hexagon < %s | FileCheck %s + +target triple = "hexagon" + +; CHECK-LABEL: ua +; CHECK: extractu(r0,#26,#0) +define i32 @ua(i32 %x) local_unnamed_addr #0 { +entry: + %shl = and i32 %x, 67108863 + ret i32 %shl +} + +; CHECK-LABEL: ub +; CHECK: extractu(r0,#16,#4) +define i32 @ub(i32 %x) local_unnamed_addr #0 { +entry: + %0 = lshr i32 %x, 4 + %shr = and i32 %0, 65535 + ret i32 %shr +} + +; CHECK-LABEL: uc +; CHECK: extractu(r0,#24,#0) +define i32 @uc(i32 %x) local_unnamed_addr #0 { +entry: + %shl = and i32 %x, 16777215 + ret i32 %shl +} + +; CHECK-LABEL: ud +; CHECK: extractu(r0,#16,#8) +define i32 @ud(i32 %x) local_unnamed_addr #0 { +entry: + %bf.lshr = lshr i32 %x, 8 + %bf.clear = and i32 %bf.lshr, 65535 + ret i32 %bf.clear +} + +; CHECK-LABEL: sa +; CHECK: extract(r0,#26,#0) +define i32 @sa(i32 %x) local_unnamed_addr #0 { +entry: + %shl = shl i32 %x, 6 + %shr = ashr exact i32 %shl, 6 + ret i32 %shr +} + +; CHECK-LABEL: sb +; CHECK: extract(r0,#16,#4) +define i32 @sb(i32 %x) local_unnamed_addr #0 { +entry: + %shl = shl i32 %x, 12 + %shr = ashr i32 %shl, 16 + ret i32 %shr +} + +; CHECK-LABEL: sc +; CHECK: extract(r0,#24,#0) +define i32 @sc(i32 %x) local_unnamed_addr #0 { +entry: + %shl = shl i32 %x, 8 + %shr = ashr exact i32 %shl, 8 + ret i32 %shr +} + +; CHECK-LABEL: sd +; CHECK: extract(r0,#16,#8) +define i32 @sd(i32 %x) local_unnamed_addr #0 { +entry: + %bf.shl = shl i32 %x, 8 + %bf.ashr = ashr i32 %bf.shl, 16 + ret i32 %bf.ashr +} + +attributes #0 = { noinline norecurse nounwind readnone "target-cpu"="hexagonv60" "target-features"="-hvx,-hvx-double,-long-calls" } diff --git a/llvm/test/CodeGen/Hexagon/bit-validate-reg.ll b/llvm/test/CodeGen/Hexagon/bit-validate-reg.ll index 16d4a5e4484..42eed97786c 100644 --- a/llvm/test/CodeGen/Hexagon/bit-validate-reg.ll +++ b/llvm/test/CodeGen/Hexagon/bit-validate-reg.ll @@ -1,10 +1,13 @@ -; RUN: llc -march=hexagon < %s | FileCheck %s +; RUN: llc -march=hexagon -hexbit-extract=0 < %s | FileCheck %s ; Make sure we don't generate zxtb to transfer a predicate register into ; a general purpose register. ; CHECK: r0 = p0 ; CHECK-NOT: zxtb(p +; CHECK-NOT: and(p +; CHECK-NOT: extract(p +; CHECK-NOT: extractu(p target triple = "hexagon" diff --git a/llvm/test/CodeGen/Hexagon/fusedandshift.ll b/llvm/test/CodeGen/Hexagon/fusedandshift.ll index 0310d440ffe..9abd366e691 100644 --- a/llvm/test/CodeGen/Hexagon/fusedandshift.ll +++ b/llvm/test/CodeGen/Hexagon/fusedandshift.ll @@ -1,4 +1,4 @@ -; RUN: llc -march=hexagon -hexagon-extract=0 < %s | FileCheck %s +; RUN: llc -march=hexagon -hexagon-extract=0 -hexbit-extract=0 < %s | FileCheck %s ; Check that we generate fused logical and with shift instruction. ; Disable "extract" generation, since it may eliminate the and/lsr. diff --git a/llvm/test/CodeGen/Hexagon/vect/vect-shuffle.ll b/llvm/test/CodeGen/Hexagon/vect/vect-shuffle.ll index bd5b2b98169..27840bbd28d 100644 --- a/llvm/test/CodeGen/Hexagon/vect/vect-shuffle.ll +++ b/llvm/test/CodeGen/Hexagon/vect/vect-shuffle.ll @@ -1,7 +1,7 @@ ; RUN: llc -march=hexagon -mcpu=hexagonv5 -disable-hsdr < %s | FileCheck %s ; Check that store is post-incremented. -; CHECK-NOT: extractu +; CHECK-NOT: extractu(r{{[0-9]+}},#32, ; CHECK-NOT: insert target datalayout = "e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:32:32-f64:64:64-f32:32:32-v64:64:64-v32:32:32-a0:0-n16:32" target triple = "hexagon" |

