1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
4 define i32 @sub_self(i32 %A) {
5 ; CHECK-LABEL: @sub_self(
6 ; CHECK-NEXT: ret i32 0
12 define <2 x i32> @sub_self_vec(<2 x i32> %A) {
13 ; CHECK-LABEL: @sub_self_vec(
14 ; CHECK-NEXT: ret <2 x i32> zeroinitializer
16 %B = sub <2 x i32> %A, %A
20 define i32 @sub_zero(i32 %A) {
21 ; CHECK-LABEL: @sub_zero(
22 ; CHECK-NEXT: ret i32 [[A:%.*]]
28 define <2 x i32> @sub_zero_vec(<2 x i32> %A) {
29 ; CHECK-LABEL: @sub_zero_vec(
30 ; CHECK-NEXT: ret <2 x i32> [[A:%.*]]
32 %B = sub <2 x i32> %A, <i32 0, i32 poison>
36 define i32 @neg_neg(i32 %A) {
37 ; CHECK-LABEL: @neg_neg(
38 ; CHECK-NEXT: ret i32 [[A:%.*]]
45 define <2 x i32> @neg_neg_vec(<2 x i32> %A) {
46 ; CHECK-LABEL: @neg_neg_vec(
47 ; CHECK-NEXT: ret <2 x i32> [[A:%.*]]
49 %B = sub <2 x i32> <i32 0, i32 poison>, %A
50 %C = sub <2 x i32> <i32 0, i32 poison>, %B
54 define i32 @poison1(i32 %x) {
55 ; CHECK-LABEL: @poison1(
56 ; CHECK-NEXT: ret i32 poison
58 %v = sub i32 %x, poison
62 define i32 @poison2(i32 %x) {
63 ; CHECK-LABEL: @poison2(
64 ; CHECK-NEXT: ret i32 poison
66 %v = sub i32 poison, %x