[llvm] f7237ee - [ConstantFolding] add tests for abs intrinsic; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 06:28:39 PDT 2020
Author: Sanjay Patel
Date: 2020-07-30T09:28:30-04:00
New Revision: f7237ee74fa629a4e79abf4bd3bc2e4d2b5d8a0a
URL: https://github.com/llvm/llvm-project/commit/f7237ee74fa629a4e79abf4bd3bc2e4d2b5d8a0a
DIFF: https://github.com/llvm/llvm-project/commit/f7237ee74fa629a4e79abf4bd3bc2e4d2b5d8a0a.diff
LOG: [ConstantFolding] add tests for abs intrinsic; NFC
Added:
llvm/test/Analysis/ConstantFolding/abs.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Analysis/ConstantFolding/abs.ll b/llvm/test/Analysis/ConstantFolding/abs.ll
new file mode 100644
index 000000000000..24171b1d4c6e
--- /dev/null
+++ b/llvm/test/Analysis/ConstantFolding/abs.ll
@@ -0,0 +1,50 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -constprop -S | FileCheck %s
+
+declare i8 @llvm.abs.i8(i8, i1)
+declare <8 x i8> @llvm.abs.v8i8(<8 x i8>, i1)
+
+define i8 @undef_val_min_poison() {
+; CHECK-LABEL: @undef_val_min_poison(
+; CHECK-NEXT: [[R:%.*]] = call i8 @llvm.abs.i8(i8 undef, i1 true)
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %r = call i8 @llvm.abs.i8(i8 undef, i1 true)
+ ret i8 %r
+}
+
+define i8 @undef_val_min_not_poison() {
+; CHECK-LABEL: @undef_val_min_not_poison(
+; CHECK-NEXT: [[R:%.*]] = call i8 @llvm.abs.i8(i8 undef, i1 false)
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %r = call i8 @llvm.abs.i8(i8 undef, i1 false)
+ ret i8 %r
+}
+
+define i8 @min_val_min_poison() {
+; CHECK-LABEL: @min_val_min_poison(
+; CHECK-NEXT: [[R:%.*]] = call i8 @llvm.abs.i8(i8 -128, i1 true)
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %r = call i8 @llvm.abs.i8(i8 -128, i1 true)
+ ret i8 %r
+}
+
+define i8 @min_val_min_not_poison() {
+; CHECK-LABEL: @min_val_min_not_poison(
+; CHECK-NEXT: [[R:%.*]] = call i8 @llvm.abs.i8(i8 -128, i1 false)
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %r = call i8 @llvm.abs.i8(i8 -128, i1 false)
+ ret i8 %r
+}
+
+define <8 x i8> @vec_const() {
+; CHECK-LABEL: @vec_const(
+; CHECK-NEXT: [[R:%.*]] = call <8 x i8> @llvm.abs.v8i8(<8 x i8> <i8 -127, i8 -126, i8 -42, i8 -1, i8 0, i8 1, i8 42, i8 127>, i1 true)
+; CHECK-NEXT: ret <8 x i8> [[R]]
+;
+ %r = call <8 x i8> @llvm.abs.v8i8(<8 x i8> <i8 -127, i8 -126, i8 -42, i8 -1, i8 0, i8 1, i8 42, i8 127>, i1 1)
+ ret <8 x i8> %r
+}
More information about the llvm-commits
mailing list