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: xorl %eax, %eax
9 ; CHECK-NEXT: ret{{[l|q]}}
10 %b = insertelement <4 x i32> zeroinitializer, i32 %x, i64 3
11 %c = icmp uge i32 %y, %y
12 %d = extractelement <4 x i32> %b, i1 %c
16 define i8 @extractelt_bitcast(i32 %x) nounwind {
17 ; X86-LABEL: extractelt_bitcast:
19 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
22 ; X64-LABEL: extractelt_bitcast:
24 ; X64-NEXT: movl %edi, %eax
25 ; X64-NEXT: # kill: def $al killed $al killed $eax
27 %bc = bitcast i32 %x to <4 x i8>
28 %ext = extractelement <4 x i8> %bc, i32 0
32 define i8 @extractelt_bitcast_extra_use(i32 %x, ptr %p) nounwind {
33 ; X86-LABEL: extractelt_bitcast_extra_use:
35 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
36 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
37 ; X86-NEXT: movl %eax, (%ecx)
38 ; X86-NEXT: # kill: def $al killed $al killed $eax
41 ; X64-LABEL: extractelt_bitcast_extra_use:
43 ; X64-NEXT: movl %edi, %eax
44 ; X64-NEXT: movl %edi, (%rsi)
45 ; X64-NEXT: # kill: def $al killed $al killed $eax
47 %bc = bitcast i32 %x to <4 x i8>
48 store <4 x i8> %bc, ptr %p
49 %ext = extractelement <4 x i8> %bc, i32 0
53 define i32 @trunc_i64_to_i32_le(i64 %x) {
54 ; X86-LABEL: trunc_i64_to_i32_le:
56 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
59 ; X64-LABEL: trunc_i64_to_i32_le:
61 ; X64-NEXT: movq %rdi, %rax
62 ; X64-NEXT: # kill: def $eax killed $eax killed $rax
64 %ins = insertelement <2 x i64> undef, i64 %x, i32 0
65 %bc = bitcast <2 x i64> %ins to <4 x i32>
66 %ext = extractelement <4 x i32> %bc, i32 0
70 define i16 @trunc_i64_to_i16_le(i64 %x) {
71 ; X86-LABEL: trunc_i64_to_i16_le:
73 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
74 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
77 ; X64-LABEL: trunc_i64_to_i16_le:
79 ; X64-NEXT: movq %rdi, %rax
80 ; X64-NEXT: # kill: def $ax killed $ax killed $rax
82 %ins = insertelement <2 x i64> undef, i64 %x, i32 0
83 %bc = bitcast <2 x i64> %ins to <8 x i16>
84 %ext = extractelement <8 x i16> %bc, i32 0
88 define i8 @trunc_i32_to_i8_le(i32 %x) {
89 ; X86-LABEL: trunc_i32_to_i8_le:
91 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
94 ; X64-LABEL: trunc_i32_to_i8_le:
96 ; X64-NEXT: movl %edi, %eax
97 ; X64-NEXT: # kill: def $al killed $al killed $eax
99 %ins = insertelement <4 x i32> undef, i32 %x, i32 0
100 %bc = bitcast <4 x i32> %ins to <16 x i8>
101 %ext = extractelement <16 x i8> %bc, i32 0