1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=X64
5 define i32 @extractelt_undef_insertelt(i32 %x, i32 %y) {
6 ; CHECK-LABEL: extractelt_undef_insertelt:
8 ; CHECK-NEXT: ret{{[l|q]}}
9 %b = insertelement <4 x i32> zeroinitializer, i32 %x, i64 3
10 %c = icmp uge i32 %y, %y
11 %d = extractelement <4 x i32> %b, i1 %c
15 define i8 @extractelt_bitcast(i32 %x) nounwind {
16 ; X86-LABEL: extractelt_bitcast:
18 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
21 ; X64-LABEL: extractelt_bitcast:
23 ; X64-NEXT: movl %edi, %eax
24 ; X64-NEXT: # kill: def $al killed $al killed $eax
26 %bc = bitcast i32 %x to <4 x i8>
27 %ext = extractelement <4 x i8> %bc, i32 0
31 define i8 @extractelt_bitcast_extra_use(i32 %x, <4 x i8>* %p) nounwind {
32 ; X86-LABEL: extractelt_bitcast_extra_use:
34 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
35 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
36 ; X86-NEXT: movl %eax, (%ecx)
37 ; X86-NEXT: # kill: def $al killed $al killed $eax
40 ; X64-LABEL: extractelt_bitcast_extra_use:
42 ; X64-NEXT: movl %edi, %eax
43 ; X64-NEXT: movl %edi, (%rsi)
44 ; X64-NEXT: # kill: def $al killed $al killed $eax
46 %bc = bitcast i32 %x to <4 x i8>
47 store <4 x i8> %bc, <4 x i8>* %p
48 %ext = extractelement <4 x i8> %bc, i32 0
52 define i32 @trunc_i64_to_i32_le(i64 %x) {
53 ; X86-LABEL: trunc_i64_to_i32_le:
55 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
58 ; X64-LABEL: trunc_i64_to_i32_le:
60 ; X64-NEXT: movq %rdi, %rax
61 ; X64-NEXT: # kill: def $eax killed $eax killed $rax
63 %ins = insertelement <2 x i64> undef, i64 %x, i32 0
64 %bc = bitcast <2 x i64> %ins to <4 x i32>
65 %ext = extractelement <4 x i32> %bc, i32 0
69 define i16 @trunc_i64_to_i16_le(i64 %x) {
70 ; X86-LABEL: trunc_i64_to_i16_le:
72 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
73 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
76 ; X64-LABEL: trunc_i64_to_i16_le:
78 ; X64-NEXT: movq %rdi, %rax
79 ; X64-NEXT: # kill: def $ax killed $ax killed $rax
81 %ins = insertelement <2 x i64> undef, i64 %x, i32 0
82 %bc = bitcast <2 x i64> %ins to <8 x i16>
83 %ext = extractelement <8 x i16> %bc, i32 0
87 define i8 @trunc_i32_to_i8_le(i32 %x) {
88 ; X86-LABEL: trunc_i32_to_i8_le:
90 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
93 ; X64-LABEL: trunc_i32_to_i8_le:
95 ; X64-NEXT: movl %edi, %eax
96 ; X64-NEXT: # kill: def $al killed $al killed $eax
98 %ins = insertelement <4 x i32> undef, i32 %x, i32 0
99 %bc = bitcast <4 x i32> %ins to <16 x i8>
100 %ext = extractelement <16 x i8> %bc, i32 0