]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/X86/constant-combines.ll
Vendor import of llvm trunk r303571:
[FreeBSD/FreeBSD.git] / test / CodeGen / X86 / constant-combines.ll
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s | FileCheck %s
3
4 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-unknown"
6
7 define void @PR22524({ float, float }* %arg) {
8 ; Check that we can materialize the zero constants we store in two places here,
9 ; and at least form a legal store of the floating point value at the end.
10 ; The DAG combiner at one point contained bugs that given enough permutations
11 ; would incorrectly form an illegal operation for the last of these stores when
12 ; it folded it to a zero too late to legalize the zero store operation. If this
13 ; ever starts forming a zero store instead of movss, the test case has stopped
14 ; being useful.
15 ;
16 ; CHECK-LABEL: PR22524:
17 ; CHECK:       # BB#0: # %entry
18 ; CHECK-NEXT:    movl $0, 4(%rdi)
19 ; CHECK-NEXT:    xorl %eax, %eax
20 ; CHECK-NEXT:    movd %eax, %xmm0
21 ; CHECK-NEXT:    xorps %xmm1, %xmm1
22 ; CHECK-NEXT:    mulss %xmm0, %xmm1
23 ; CHECK-NEXT:    movl $0, (%rdi)
24 ; CHECK-NEXT:    movss %xmm1, 4(%rdi)
25 ; CHECK-NEXT:    retq
26 entry:
27   %0 = getelementptr inbounds { float, float }, { float, float }* %arg,  i32 0, i32 1
28   store float 0.000000e+00, float* %0, align 4
29   %1 = getelementptr inbounds { float, float }, { float, float }* %arg, i64 0,  i32 0
30   %2 = bitcast float* %1 to i64*
31   %3 = load i64, i64* %2, align 8
32   %4 = trunc i64 %3 to i32
33   %5 = lshr i64 %3, 32
34   %6 = trunc i64 %5 to i32
35   %7 = bitcast i32 %6 to float
36   %8 = fmul float %7, 0.000000e+00
37   %9 = bitcast float* %1 to i32*
38   store i32 %6, i32* %9, align 4
39   store float %8, float* %0, align 4
40   ret void
41 }