]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/X86/trunc-store.ll
Vendor import of llvm trunk r291274:
[FreeBSD/FreeBSD.git] / test / CodeGen / X86 / trunc-store.ll
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s
3
4 ; With optimization at O2 we actually get the legalized function optimized
5 ; away through legalization and stack coloring, but check that we do all of
6 ; that here and don't crash during legalization.
7
8 ; Original program:
9 ; typedef enum { A, B, C, D } P;
10 ; struct { P x[2]; } a;
11
12 ; void fn2();
13 ; void fn1() {
14 ;   int b;
15 ;   unsigned c;
16 ;   for (;; c++) {
17 ;     fn2();
18 ;     unsigned n;
19 ;     for (; c; c++) {
20 ;       b = a.x[c] == A || a.x[c] == B || a.x[c] == D;
21 ;       if (b) n++;
22 ;     }
23 ;     if (n)
24 ;       for (;;)
25 ;         ;
26 ;   }
27 ; }
28
29 define void @fn1() {
30 ; CHECK-LABEL: fn1:
31 ; CHECK:       # BB#0: # %for.cond
32 ; CHECK-NEXT:    .p2align 4, 0x90
33 ; CHECK-NEXT:  .LBB0_1: # %vector.body
34 ; CHECK-NEXT:    # =>This Inner Loop Header: Depth=1
35 ; CHECK-NEXT:    movb $0, -{{[0-9]+}}(%rsp)
36 ; CHECK-NEXT:    cmpq $8, %rax
37 ; CHECK-NEXT:    jne .LBB0_1
38 ; CHECK-NEXT:  # BB#2: # %middle.block
39 ; CHECK-NEXT:    retq
40 for.cond:
41   br label %vector.body
42
43 vector.body:                                      ; preds = %vector.body, %for.cond
44   %x42 = bitcast <4 x i4> zeroinitializer to i16
45   %x43 = icmp ne i16 %x42, 0
46   %x44 = select i1 %x43, i32 undef, i32 0
47   %x72 = bitcast <4 x i1> zeroinitializer to i4
48   %x73 = icmp ne i4 %x72, 0
49   %x74 = select i1 %x73, i32 %x44, i32 undef
50   %x84 = select i1 undef, i32 undef, i32 %x74
51   %x88 = icmp eq i64 undef, 8
52   br i1 %x88, label %middle.block, label %vector.body
53
54 middle.block:                                     ; preds = %vector.body
55   %0 = select i1 undef, i32 undef, i32 %x84
56   ret void
57 }