1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+mmx < %s | FileCheck %s --check-prefix=X64
3 ; RUN: llc -mtriple=i686-unknown-unknown -mattr=+mmx < %s | FileCheck %s --check-prefix=X86
6 ; From source: clang -02
9 ; __m64 x = (a)? (__m64)(7): (__m64)(0);
10 ; return __builtin_ia32_psllw(x, x);
13 define i64 @test47(i64 %arg) {
17 ; X64-NEXT: xorl %eax, %eax
18 ; X64-NEXT: testq %rdi, %rdi
19 ; X64-NEXT: movl $7, %ecx
20 ; X64-NEXT: cmovneq %rax, %rcx
21 ; X64-NEXT: movq %rcx, %mm0
22 ; X64-NEXT: psllw %mm0, %mm0
23 ; X64-NEXT: movq %mm0, %rax
28 ; X86-NEXT: pushl %ebp
29 ; X86-NEXT: .cfi_def_cfa_offset 8
30 ; X86-NEXT: .cfi_offset %ebp, -8
31 ; X86-NEXT: movl %esp, %ebp
32 ; X86-NEXT: .cfi_def_cfa_register %ebp
33 ; X86-NEXT: andl $-8, %esp
34 ; X86-NEXT: subl $16, %esp
35 ; X86-NEXT: movl 8(%ebp), %eax
36 ; X86-NEXT: orl 12(%ebp), %eax
37 ; X86-NEXT: movl $7, %eax
38 ; X86-NEXT: je .LBB0_2
40 ; X86-NEXT: xorl %eax, %eax
42 ; X86-NEXT: movl %eax, {{[0-9]+}}(%esp)
43 ; X86-NEXT: movl $0, {{[0-9]+}}(%esp)
44 ; X86-NEXT: movq {{[0-9]+}}(%esp), %mm0
45 ; X86-NEXT: psllw %mm0, %mm0
46 ; X86-NEXT: movq %mm0, (%esp)
47 ; X86-NEXT: movl (%esp), %eax
48 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
49 ; X86-NEXT: movl %ebp, %esp
51 ; X86-NEXT: .cfi_def_cfa %esp, 4
53 %cond = icmp eq i64 %arg, 0
54 %slct = select i1 %cond, <1 x i64> bitcast (i64 7 to <1 x i64>), <1 x i64> bitcast (i64 0 to <1 x i64>)
55 %psll = tail call <1 x i64> @llvm.x86.mmx.psll.w(<1 x i64> %slct, <1 x i64> %slct)
56 %retc = bitcast <1 x i64> %psll to i64
61 ; From source: clang -O2
62 ;__m64 test49(int a, long long n, long long m)
64 ; __m64 x = (a)? (__m64)(n): (__m64)(m);
65 ; return __builtin_ia32_psllw(x, x);
68 define i64 @test49(i64 %arg, i64 %x, i64 %y) {
72 ; X64-NEXT: testq %rdi, %rdi
73 ; X64-NEXT: cmovneq %rdx, %rsi
74 ; X64-NEXT: movq %rsi, %mm0
75 ; X64-NEXT: psllw %mm0, %mm0
76 ; X64-NEXT: movq %mm0, %rax
81 ; X86-NEXT: pushl %ebp
82 ; X86-NEXT: .cfi_def_cfa_offset 8
83 ; X86-NEXT: .cfi_offset %ebp, -8
84 ; X86-NEXT: movl %esp, %ebp
85 ; X86-NEXT: .cfi_def_cfa_register %ebp
86 ; X86-NEXT: andl $-8, %esp
87 ; X86-NEXT: subl $8, %esp
88 ; X86-NEXT: movl 8(%ebp), %eax
89 ; X86-NEXT: orl 12(%ebp), %eax
90 ; X86-NEXT: je .LBB1_1
92 ; X86-NEXT: leal 24(%ebp), %eax
93 ; X86-NEXT: jmp .LBB1_3
95 ; X86-NEXT: leal 16(%ebp), %eax
97 ; X86-NEXT: movq (%eax), %mm0
98 ; X86-NEXT: psllw %mm0, %mm0
99 ; X86-NEXT: movq %mm0, (%esp)
100 ; X86-NEXT: movl (%esp), %eax
101 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
102 ; X86-NEXT: movl %ebp, %esp
103 ; X86-NEXT: popl %ebp
104 ; X86-NEXT: .cfi_def_cfa %esp, 4
106 %cond = icmp eq i64 %arg, 0
107 %xmmx = bitcast i64 %x to <1 x i64>
108 %ymmx = bitcast i64 %y to <1 x i64>
109 %slct = select i1 %cond, <1 x i64> %xmmx, <1 x i64> %ymmx
110 %psll = tail call <1 x i64> @llvm.x86.mmx.psll.w(<1 x i64> %slct, <1 x i64> %slct)
111 %retc = bitcast <1 x i64> %psll to i64
115 declare <1 x i64> @llvm.x86.mmx.psll.w(<1 x i64>, <1 x i64>)