1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-pc-linux -mattr=+sse4.2 < %s | FileCheck %s --check-prefix=X86-64
3; RUN: llc -mtriple=i386-pc-linux -mattr=+sse4.2 < %s | FileCheck %s --check-prefix=I386
4
5; Check that unaligned loads merge with cvtdq2pd and cvtps2pd.
6
7define <2 x double> @peephole_cvtps2pd(<4 x float>* %a0) {
8; X86-64-LABEL: peephole_cvtps2pd:
9; X86-64:       # %bb.0:
10; X86-64-NEXT:    cvtps2pd (%rdi), %xmm0
11; X86-64-NEXT:    retq
12;
13; I386-LABEL: peephole_cvtps2pd:
14; I386:       # %bb.0:
15; I386-NEXT:    movl {{[0-9]+}}(%esp), %eax
16; I386-NEXT:    cvtps2pd (%eax), %xmm0
17; I386-NEXT:    retl
18  %1 = load <4 x float>, <4 x float>* %a0, align 1
19  %2 = shufflevector <4 x float> %1, <4 x float> undef, <2 x i32> <i32 0, i32 1>
20  %3 = fpext <2 x float> %2 to <2 x double>
21  ret <2 x double> %3
22}
23
24define <2 x double> @peephole_cvtdq2pd(<4 x i32>* %a0) {
25; X86-64-LABEL: peephole_cvtdq2pd:
26; X86-64:       # %bb.0:
27; X86-64-NEXT:    cvtdq2pd (%rdi), %xmm0
28; X86-64-NEXT:    retq
29;
30; I386-LABEL: peephole_cvtdq2pd:
31; I386:       # %bb.0:
32; I386-NEXT:    movl {{[0-9]+}}(%esp), %eax
33; I386-NEXT:    cvtdq2pd (%eax), %xmm0
34; I386-NEXT:    retl
35  %1 = load <4 x i32>, <4 x i32>* %a0, align 1
36  %2 = shufflevector <4 x i32> %1, <4 x i32> undef, <2 x i32> <i32 0, i32 1>
37  %3 = sitofp <2 x i32> %2 to <2 x double>
38  ret <2 x double> %3
39}
40