[llvm] r239935 - [Hexagon] Adding a number of other tests for min/max instructions and loading i1s.
Colin LeMahieu
colinl at codeaurora.org
Wed Jun 17 13:29:33 PDT 2015
Author: colinl
Date: Wed Jun 17 15:29:33 2015
New Revision: 239935
URL: http://llvm.org/viewvc/llvm-project?rev=239935&view=rev
Log:
[Hexagon] Adding a number of other tests for min/max instructions and loading i1s.
Added:
llvm/trunk/test/CodeGen/Hexagon/cext.ll
llvm/trunk/test/CodeGen/Hexagon/cexti16.ll
llvm/trunk/test/CodeGen/Hexagon/loadi1-G0.ll
llvm/trunk/test/CodeGen/Hexagon/loadi1-v4-G0.ll
llvm/trunk/test/CodeGen/Hexagon/loadi1-v4.ll
llvm/trunk/test/CodeGen/Hexagon/loadi1.ll
llvm/trunk/test/CodeGen/Hexagon/maxd.ll
llvm/trunk/test/CodeGen/Hexagon/maxh.ll
llvm/trunk/test/CodeGen/Hexagon/maxud.ll
llvm/trunk/test/CodeGen/Hexagon/maxuw.ll
llvm/trunk/test/CodeGen/Hexagon/maxw.ll
llvm/trunk/test/CodeGen/Hexagon/mind.ll
llvm/trunk/test/CodeGen/Hexagon/minu-zext-16.ll
llvm/trunk/test/CodeGen/Hexagon/minu-zext-8.ll
llvm/trunk/test/CodeGen/Hexagon/minud.ll
llvm/trunk/test/CodeGen/Hexagon/minuw.ll
llvm/trunk/test/CodeGen/Hexagon/minw.ll
Modified:
llvm/trunk/test/CodeGen/Hexagon/hwloop-lt.ll
llvm/trunk/test/CodeGen/Hexagon/hwloop-lt1.ll
Added: llvm/trunk/test/CodeGen/Hexagon/cext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/cext.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/cext.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/cext.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,16 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: memub(r{{[0-9]+}}{{ *}}<<{{ *}}#1{{ *}}+{{ *}}##a)
+
+ at a = external global [5 x [2 x i8]]
+
+define zeroext i8 @foo(i8 zeroext %l) nounwind readonly {
+for.end:
+ %idxprom = zext i8 %l to i32
+ %arrayidx1 = getelementptr inbounds [5 x [2 x i8]], [5 x [2 x i8]]* @a, i32 0, i32 %idxprom, i32 0
+ %0 = load i8, i8* %arrayidx1, align 1
+ %conv = zext i8 %0 to i32
+ %mul = mul nsw i32 %conv, 20
+ %conv2 = trunc i32 %mul to i8
+ ret i8 %conv2
+}
+
Added: llvm/trunk/test/CodeGen/Hexagon/cexti16.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/cexti16.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/cexti16.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/cexti16.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,16 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: memuh(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##a)
+
+ at a = external global [5 x [2 x i16]]
+
+define signext i16 @foo(i16 zeroext %l) nounwind readonly {
+for.end:
+ %idxprom = zext i16 %l to i32
+ %arrayidx1 = getelementptr inbounds [5 x [2 x i16]], [5 x [2 x i16]]* @a, i32 0, i32 %idxprom, i32 0
+ %0 = load i16, i16* %arrayidx1, align 2
+ %conv = zext i16 %0 to i32
+ %mul = mul nsw i32 %conv, 20
+ %conv2 = trunc i32 %mul to i16
+ ret i16 %conv2
+}
+
Modified: llvm/trunk/test/CodeGen/Hexagon/hwloop-lt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/hwloop-lt.ll?rev=239935&r1=239934&r2=239935&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/hwloop-lt.ll (original)
+++ llvm/trunk/test/CodeGen/Hexagon/hwloop-lt.ll Wed Jun 17 15:29:33 2015
@@ -1,4 +1,4 @@
-; RUN: llc -march=hexagon -mcpu=hexagonv4 -O3 < %s | FileCheck %s
+; RUN: llc -march=hexagon -O3 < %s | FileCheck %s
; CHECK-LABEL: @test_pos1_ir_slt
; CHECK: loop0
Modified: llvm/trunk/test/CodeGen/Hexagon/hwloop-lt1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/hwloop-lt1.ll?rev=239935&r1=239934&r2=239935&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/hwloop-lt1.ll (original)
+++ llvm/trunk/test/CodeGen/Hexagon/hwloop-lt1.ll Wed Jun 17 15:29:33 2015
@@ -1,4 +1,4 @@
-; RUN: llc -march=hexagon -mcpu=hexagonv4 < %s | FileCheck %s
+; RUN: llc -march=hexagon < %s | FileCheck %s
; Check that we generate a hardware loop instruction.
; CHECK: endloop0
Added: llvm/trunk/test/CodeGen/Hexagon/loadi1-G0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/loadi1-G0.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/loadi1-G0.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/loadi1-G0.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,43 @@
+; RUN: llc -march=hexagon -mcpu=hexagonv5 -hexagon-small-data-threshold=0 < %s | FileCheck %s
+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-a0:0-n32"
+target triple = "hexagon-unknown-linux-gnu"
+
+
+ at flag = external global i1
+
+
+; CHECK-NOT: CONST
+
+define i32 @test_sextloadi1_32() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+ %1 = sext i1 %0 to i32
+ ret i32 %1
+}
+
+
+
+define i16 @test_zextloadi1_16() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+ %1 = zext i1 %0 to i16
+ ret i16 %1
+}
+
+
+define i32 @test_zextloadi1_32() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+ %1 = zext i1 %0 to i32
+ ret i32 %1
+}
+
+
+define i64 @test_zextloadi1_64() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+ %1 = zext i1 %0 to i64
+ ret i64 %1
+}
+
+
Added: llvm/trunk/test/CodeGen/Hexagon/loadi1-v4-G0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/loadi1-v4-G0.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/loadi1-v4-G0.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/loadi1-v4-G0.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,43 @@
+; RUN: llc -march=hexagon -hexagon-small-data-threshold=0 < %s | FileCheck %s
+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-a0:0-n32"
+target triple = "hexagon-unknown-linux-gnu"
+
+
+ at flag = external global i1
+
+
+; CHECK-NOT: CONST
+
+define i32 @test_sextloadi1_32() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+ %1 = sext i1 %0 to i32
+ ret i32 %1
+}
+
+
+
+define i16 @test_zextloadi1_16() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+ %1 = zext i1 %0 to i16
+ ret i16 %1
+}
+
+
+define i32 @test_zextloadi1_32() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+ %1 = zext i1 %0 to i32
+ ret i32 %1
+}
+
+
+define i64 @test_zextloadi1_64() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+ %1 = zext i1 %0 to i64
+ ret i64 %1
+}
+
+
Added: llvm/trunk/test/CodeGen/Hexagon/loadi1-v4.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/loadi1-v4.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/loadi1-v4.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/loadi1-v4.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,45 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+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-a0:0-n32"
+target triple = "hexagon-unknown-linux-gnu"
+
+
+ at flag = external global i1
+
+
+define i32 @test_sextloadi1_32() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+; CHECK: memub
+ %1 = sext i1 %0 to i32
+ ret i32 %1
+}
+
+
+
+define i16 @test_zextloadi1_16() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+; CHECK: memub
+ %1 = zext i1 %0 to i16
+ ret i16 %1
+}
+
+
+define i32 @test_zextloadi1_32() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+; CHECK: memub
+ %1 = zext i1 %0 to i32
+ ret i32 %1
+}
+
+
+define i64 @test_zextloadi1_64() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+; CHECK: memub
+ %1 = zext i1 %0 to i64
+ ret i64 %1
+}
+
+
Added: llvm/trunk/test/CodeGen/Hexagon/loadi1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/loadi1.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/loadi1.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/loadi1.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,45 @@
+; RUN: llc -march=hexagon -mcpu=hexagonv5 < %s | FileCheck %s
+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-a0:0-n32"
+target triple = "hexagon-unknown-linux-gnu"
+
+
+ at flag = external global i1
+
+
+define i32 @test_sextloadi1_32() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+; CHECK: memub
+ %1 = sext i1 %0 to i32
+ ret i32 %1
+}
+
+
+
+define i16 @test_zextloadi1_16() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+; CHECK: memub
+ %1 = zext i1 %0 to i16
+ ret i16 %1
+}
+
+
+define i32 @test_zextloadi1_32() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+; CHECK: memub
+ %1 = zext i1 %0 to i32
+ ret i32 %1
+}
+
+
+define i64 @test_zextloadi1_64() {
+entry:
+ %0 = load i1, i1* @flag, align 4
+; CHECK: memub
+ %1 = zext i1 %0 to i64
+ ret i64 %1
+}
+
+
Added: llvm/trunk/test/CodeGen/Hexagon/maxd.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/maxd.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/maxd.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/maxd.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,9 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: max
+
+define i64 @f(i64 %src, i64 %maxval) nounwind readnone {
+entry:
+ %cmp = icmp slt i64 %maxval, %src
+ %cond = select i1 %cmp, i64 %src, i64 %maxval
+ ret i64 %cond
+}
Added: llvm/trunk/test/CodeGen/Hexagon/maxh.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/maxh.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/maxh.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/maxh.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,23 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; The result of max(half-word, half-word) is also half-word.
+; Check that we are not producing a sign extend after the max.
+; CHECK-NOT: sxth
+
+define i64 @test_cast(i64 %arg0, i16 zeroext %arg1, i16 zeroext %arg2) nounwind readnone {
+entry:
+ %conv.i = zext i16 %arg1 to i32
+ %conv1.i = zext i16 %arg2 to i32
+ %sub.i = sub nsw i32 %conv.i, %conv1.i
+ %sext.i = shl i32 %sub.i, 16
+ %cmp.i = icmp slt i32 %sext.i, 65536
+ %0 = ashr exact i32 %sext.i, 16
+ %conv7.i = select i1 %cmp.i, i32 1, i32 %0
+ %cmp8.i = icmp sgt i32 %conv7.i, 4
+ %conv7.op.i = add i32 %conv7.i, 65535
+ %shl = shl i64 %arg0, 2
+ %.mask = and i32 %conv7.op.i, 65535
+ %1 = zext i32 %.mask to i64
+ %conv = select i1 %cmp8.i, i64 3, i64 %1
+ %or = or i64 %conv, %shl
+ ret i64 %or
+}
Added: llvm/trunk/test/CodeGen/Hexagon/maxud.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/maxud.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/maxud.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/maxud.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,9 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: maxu
+
+define i64 @f(i64 %src, i64 %maxval) nounwind readnone {
+entry:
+ %cmp = icmp ult i64 %maxval, %src
+ %cond = select i1 %cmp, i64 %src, i64 %maxval
+ ret i64 %cond
+}
Added: llvm/trunk/test/CodeGen/Hexagon/maxuw.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/maxuw.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/maxuw.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/maxuw.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,9 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: maxu
+
+define i32 @f(i32 %src, i32 %maxval) nounwind readnone {
+entry:
+ %cmp = icmp ult i32 %maxval, %src
+ %cond = select i1 %cmp, i32 %src, i32 %maxval
+ ret i32 %cond
+}
Added: llvm/trunk/test/CodeGen/Hexagon/maxw.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/maxw.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/maxw.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/maxw.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,9 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: max
+
+define i32 @f(i32 %src, i32 %maxval) nounwind readnone {
+entry:
+ %cmp = icmp slt i32 %maxval, %src
+ %cond = select i1 %cmp, i32 %src, i32 %maxval
+ ret i32 %cond
+}
Added: llvm/trunk/test/CodeGen/Hexagon/mind.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/mind.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/mind.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/mind.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,9 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: min
+
+define i64 @f(i64 %src, i64 %maxval) nounwind readnone {
+entry:
+ %cmp = icmp sgt i64 %maxval, %src
+ %cond = select i1 %cmp, i64 %src, i64 %maxval
+ ret i64 %cond
+}
Added: llvm/trunk/test/CodeGen/Hexagon/minu-zext-16.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/minu-zext-16.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/minu-zext-16.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/minu-zext-16.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,11 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: minu
+
+define zeroext i16 @f(i16* noalias nocapture %src) nounwind readonly {
+entry:
+ %arrayidx = getelementptr inbounds i16, i16* %src, i32 1
+ %0 = load i16, i16* %arrayidx, align 1
+ %cmp = icmp ult i16 %0, 32767
+ %. = select i1 %cmp, i16 %0, i16 32767
+ ret i16 %.
+}
Added: llvm/trunk/test/CodeGen/Hexagon/minu-zext-8.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/minu-zext-8.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/minu-zext-8.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/minu-zext-8.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,11 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: minu
+
+define zeroext i8 @f(i8* noalias nocapture %src) nounwind readonly {
+entry:
+ %arrayidx = getelementptr inbounds i8, i8* %src, i32 1
+ %0 = load i8, i8* %arrayidx, align 1
+ %cmp = icmp ult i8 %0, 127
+ %. = select i1 %cmp, i8 %0, i8 127
+ ret i8 %.
+}
Added: llvm/trunk/test/CodeGen/Hexagon/minud.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/minud.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/minud.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/minud.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,9 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: minu
+
+define i64 @f(i64 %src, i64 %maxval) nounwind readnone {
+entry:
+ %cmp = icmp ugt i64 %maxval, %src
+ %cond = select i1 %cmp, i64 %src, i64 %maxval
+ ret i64 %cond
+}
Added: llvm/trunk/test/CodeGen/Hexagon/minuw.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/minuw.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/minuw.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/minuw.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,9 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: minu
+
+define i32 @f(i32 %src, i32 %maxval) nounwind readnone {
+entry:
+ %cmp = icmp ugt i32 %maxval, %src
+ %cond = select i1 %cmp, i32 %src, i32 %maxval
+ ret i32 %cond
+}
Added: llvm/trunk/test/CodeGen/Hexagon/minw.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/minw.ll?rev=239935&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/minw.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/minw.ll Wed Jun 17 15:29:33 2015
@@ -0,0 +1,9 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; CHECK: min
+
+define i32 @f(i32 %src, i32 %maxval) nounwind readnone {
+entry:
+ %cmp = icmp sgt i32 %maxval, %src
+ %cond = select i1 %cmp, i32 %src, i32 %maxval
+ ret i32 %cond
+}
More information about the llvm-commits
mailing list