1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
4 define i32 @negate_nuw(i32 %x) {
5 ; CHECK-LABEL: negate_nuw:
7 ; CHECK-NEXT: xorl %eax, %eax
9 %neg = sub nuw i32 0, %x
13 define <4 x i32> @negate_nuw_vec(<4 x i32> %x) {
14 ; CHECK-LABEL: negate_nuw_vec:
16 ; CHECK-NEXT: xorps %xmm0, %xmm0
18 %neg = sub nuw <4 x i32> zeroinitializer, %x
22 define i8 @negate_zero_or_minsigned_nsw(i8 %x) {
23 ; CHECK-LABEL: negate_zero_or_minsigned_nsw:
25 ; CHECK-NEXT: xorl %eax, %eax
27 %signbit = and i8 %x, 128
28 %neg = sub nsw i8 0, %signbit
32 define <4 x i32> @negate_zero_or_minsigned_nsw_vec(<4 x i32> %x) {
33 ; CHECK-LABEL: negate_zero_or_minsigned_nsw_vec:
35 ; CHECK-NEXT: xorps %xmm0, %xmm0
37 %signbit = shl <4 x i32> %x, <i32 31, i32 31, i32 31, i32 31>
38 %neg = sub nsw <4 x i32> zeroinitializer, %signbit
42 define i8 @negate_zero_or_minsigned(i8 %x) {
43 ; CHECK-LABEL: negate_zero_or_minsigned:
45 ; CHECK-NEXT: movl %edi, %eax
46 ; CHECK-NEXT: shlb $7, %al
47 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
49 %signbit = shl i8 %x, 7
50 %neg = sub i8 0, %signbit
54 define <4 x i32> @negate_zero_or_minsigned_vec(<4 x i32> %x) {
55 ; CHECK-LABEL: negate_zero_or_minsigned_vec:
57 ; CHECK-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
59 %signbit = and <4 x i32> %x, <i32 2147483648, i32 2147483648, i32 2147483648, i32 2147483648>
60 %neg = sub <4 x i32> zeroinitializer, %signbit