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 4 5 6; From source: clang -02 7;__m64 test47(int a) 8;{ 9; __m64 x = (a)? (__m64)(7): (__m64)(0); 10; return __builtin_ia32_psllw(x, x); 11;} 12 13define i64 @test47(i64 %arg) { 14; 15; X64-LABEL: test47: 16; X64: # %bb.0: 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 24; X64-NEXT: retq 25; 26; X86-LABEL: test47: 27; X86: # %bb.0: 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 39; X86-NEXT: # %bb.1: 40; X86-NEXT: xorl %eax, %eax 41; X86-NEXT: .LBB0_2: 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 50; X86-NEXT: popl %ebp 51; X86-NEXT: .cfi_def_cfa %esp, 4 52; X86-NEXT: retl 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 57 ret i64 %retc 58} 59 60 61; From source: clang -O2 62;__m64 test49(int a, long long n, long long m) 63;{ 64; __m64 x = (a)? (__m64)(n): (__m64)(m); 65; return __builtin_ia32_psllw(x, x); 66;} 67 68define i64 @test49(i64 %arg, i64 %x, i64 %y) { 69; 70; X64-LABEL: test49: 71; X64: # %bb.0: 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 77; X64-NEXT: retq 78; 79; X86-LABEL: test49: 80; X86: # %bb.0: 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 91; X86-NEXT: # %bb.2: 92; X86-NEXT: leal 24(%ebp), %eax 93; X86-NEXT: jmp .LBB1_3 94; X86-NEXT: .LBB1_1: 95; X86-NEXT: leal 16(%ebp), %eax 96; X86-NEXT: .LBB1_3: 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 105; X86-NEXT: retl 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 112 ret i64 %retc 113} 114 115declare <1 x i64> @llvm.x86.mmx.psll.w(<1 x i64>, <1 x i64>) 116 117