Generalize the "trunc(ptrtoint(x)) - trunc(ptrtoint(y)) ->
[oota-llvm.git] / test / Transforms / InstSimplify / reassociate.ll
index 3c8169e5e283ff9e7e95337ad18fc3e9efdb998f..e659e6f42c8dd3148429ecedc0f3691f0f4173b8 100644 (file)
@@ -184,3 +184,12 @@ define i32 @udiv5(i32 %x, i32 %y) {
 ; CHECK: ret i32 %x
 }
 
+define i16 @trunc1(i32 %x) {
+; CHECK: @trunc1
+  %y = add i32 %x, 1
+  %tx = trunc i32 %x to i16
+  %ty = trunc i32 %y to i16
+  %d = sub i16 %ty, %tx
+  ret i16 %d
+; CHECK: ret i16 1
+}