blob: fadbf02f0c24186c3a49f0fd0b540e00beffa629 [file] [log] [blame]
Sanjay Patel7b4e4af2016-10-14 14:14:40 +00001; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
3
4define i32 @neg_lshr_signbit(i32 %x) {
5; X64-LABEL: neg_lshr_signbit:
6; X64: # BB#0:
7; X64-NEXT: shrl $31, %edi
8; X64-NEXT: negl %edi
9; X64-NEXT: movl %edi, %eax
10; X64-NEXT: retq
11;
12 %sh = lshr i32 %x, 31
13 %neg = sub i32 0, %sh
14 ret i32 %neg
15}
16
17define i64 @neg_ashr_signbit(i64 %x) {
18; X64-LABEL: neg_ashr_signbit:
19; X64: # BB#0:
20; X64-NEXT: sarq $63, %rdi
21; X64-NEXT: negq %rdi
22; X64-NEXT: movq %rdi, %rax
23; X64-NEXT: retq
24;
25 %sh = ashr i64 %x, 63
26 %neg = sub i64 0, %sh
27 ret i64 %neg
28}
29
30define <4 x i32> @neg_ashr_signbit_vec(<4 x i32> %x) {
31; X64-LABEL: neg_ashr_signbit_vec:
32; X64: # BB#0:
33; X64-NEXT: psrad $31, %xmm0
34; X64-NEXT: pxor %xmm1, %xmm1
35; X64-NEXT: psubd %xmm0, %xmm1
36; X64-NEXT: movdqa %xmm1, %xmm0
37; X64-NEXT: retq
38;
39 %sh = ashr <4 x i32> %x, <i32 31, i32 31, i32 31, i32 31>
40 %neg = sub <4 x i32> zeroinitializer, %sh
41 ret <4 x i32> %neg
42}
43
44define <8 x i16> @neg_lshr_signbit_vec(<8 x i16> %x) {
45; X64-LABEL: neg_lshr_signbit_vec:
46; X64: # BB#0:
47; X64-NEXT: psrlw $15, %xmm0
48; X64-NEXT: pxor %xmm1, %xmm1
49; X64-NEXT: psubw %xmm0, %xmm1
50; X64-NEXT: movdqa %xmm1, %xmm0
51; X64-NEXT: retq
52;
53 %sh = lshr <8 x i16> %x, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
54 %neg = sub <8 x i16> zeroinitializer, %sh
55 ret <8 x i16> %neg
56}
57