[llvm] r295572 - [InstSimplify] add tests for add nsw/nuw (xor X, signbit), signbit --> X; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 18 13:51:15 PST 2017
Author: spatel
Date: Sat Feb 18 15:51:14 2017
New Revision: 295572
URL: http://llvm.org/viewvc/llvm-project?rev=295572&view=rev
Log:
[InstSimplify] add tests for add nsw/nuw (xor X, signbit), signbit --> X; NFC
Modified:
llvm/trunk/test/Transforms/InstSimplify/AndOrXor.ll
Modified: llvm/trunk/test/Transforms/InstSimplify/AndOrXor.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/AndOrXor.ll?rev=295572&r1=295571&r2=295572&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/AndOrXor.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/AndOrXor.ll Sat Feb 18 15:51:14 2017
@@ -1,6 +1,32 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s
+; add nsw (xor X, signbit), signbit --> X
+
+define <2 x i32> @add_nsw_signbit(<2 x i32> %x) {
+; CHECK-LABEL: @add_nsw_signbit(
+; CHECK-NEXT: [[Y:%.*]] = xor <2 x i32> %x, <i32 -2147483648, i32 -2147483648>
+; CHECK-NEXT: [[Z:%.*]] = add nsw <2 x i32> [[Y]], <i32 -2147483648, i32 -2147483648>
+; CHECK-NEXT: ret <2 x i32> [[Z]]
+;
+ %y = xor <2 x i32> %x, <i32 -2147483648, i32 -2147483648>
+ %z = add nsw <2 x i32> %y, <i32 -2147483648, i32 -2147483648>
+ ret <2 x i32> %z
+}
+
+; add nuw (xor X, signbit), signbit --> X
+
+define <2 x i5> @add_nuw_signbit(<2 x i5> %x) {
+; CHECK-LABEL: @add_nuw_signbit(
+; CHECK-NEXT: [[Y:%.*]] = xor <2 x i5> %x, <i5 -16, i5 -16>
+; CHECK-NEXT: [[Z:%.*]] = add nuw <2 x i5> [[Y]], <i5 -16, i5 -16>
+; CHECK-NEXT: ret <2 x i5> [[Z]]
+;
+ %y = xor <2 x i5> %x, <i5 -16, i5 -16>
+ %z = add nuw <2 x i5> %y, <i5 -16, i5 -16>
+ ret <2 x i5> %z
+}
+
define i64 @pow2(i32 %x) {
; CHECK-LABEL: @pow2(
; CHECK-NEXT: [[NEGX:%.*]] = sub i32 0, %x
More information about the llvm-commits
mailing list