Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -march=x86-64 -mcpu=corei7-avx -disable-lsr -pre-RA-sched=source -enable-misched -verify-machineinstrs | FileCheck %s
      2 
      3 ; Verify that TEST+JE are scheduled together.
      4 ; CHECK: test_je
      5 ; CHECK: %loop
      6 ; CHECK: test
      7 ; CHECK-NEXT: je
      8 define void @test_je() {
      9 entry:
     10   br label %loop
     11 
     12 loop:
     13   %var = phi i32* [ null, %entry ], [ %next.load, %loop1 ], [ %var, %loop2 ]
     14   %next.ptr = phi i32** [ null, %entry ], [ %next.ptr, %loop1 ], [ %gep, %loop2 ]
     15   br label %loop1
     16 
     17 loop1:
     18   %cond = icmp eq i32* %var, null
     19   %next.load = load i32*, i32** %next.ptr
     20   br i1 %cond, label %loop, label %loop2
     21 
     22 loop2:                                           ; preds = %loop1
     23   %gep = getelementptr inbounds i32*, i32** %next.ptr, i32 1
     24   store i32* %next.load, i32** undef
     25   br label %loop
     26 }
     27 
     28 ; Verify that DEC+JE are scheduled together.
     29 ; CHECK: dec_je
     30 ; CHECK: %loop1
     31 ; CHECK: dec
     32 ; CHECK-NEXT: je
     33 define void @dec_je() {
     34 entry:
     35   br label %loop
     36 
     37 loop:
     38   %var = phi i32 [ 0, %entry ], [ %next.var, %loop1 ], [ %var2, %loop2 ]
     39   %next.ptr = phi i32** [ null, %entry ], [ %next.ptr, %loop1 ], [ %gep, %loop2 ]
     40   br label %loop1
     41 
     42 loop1:
     43   %var2 = sub i32 %var, 1
     44   %cond = icmp eq i32 %var2, 0
     45   %next.load = load i32*, i32** %next.ptr
     46   %next.var = load i32, i32* %next.load
     47   br i1 %cond, label %loop, label %loop2
     48 
     49 loop2:
     50   %gep = getelementptr inbounds i32*, i32** %next.ptr, i32 1
     51   store i32* %next.load, i32** undef
     52   br label %loop
     53 }
     54 
     55 ; DEC+JS should *not* be scheduled together.
     56 ; CHECK: dec_js
     57 ; CHECK: %loop1
     58 ; CHECK: dec
     59 ; CHECK: mov
     60 ; CHECK: js
     61 define void @dec_js() {
     62 entry:
     63   br label %loop2a
     64 
     65 loop2a:                                           ; preds = %loop1, %body, %entry
     66   %var = phi i32 [ 0, %entry ], [ %next.var, %loop1 ], [ %var2, %loop2b ]
     67   %next.ptr = phi i32** [ null, %entry ], [ %next.ptr, %loop1 ], [ %gep, %loop2b ]
     68   br label %loop1
     69 
     70 loop1:                                            ; preds = %loop2a, %loop2b
     71   %var2 = sub i32 %var, 1
     72   %cond = icmp slt i32 %var2, 0
     73   %next.load = load i32*, i32** %next.ptr
     74   %next.var = load i32, i32* %next.load
     75   br i1 %cond, label %loop2a, label %loop2b
     76 
     77 loop2b:                                           ; preds = %loop1
     78   %gep = getelementptr inbounds i32*, i32** %next.ptr, i32 1
     79   store i32* %next.load, i32** undef
     80   br label %loop2a
     81 }
     82 
     83 ; Verify that CMP+JB are scheduled together.
     84 ; CHECK: cmp_jb
     85 ; CHECK: %loop1
     86 ; CHECK: cmp
     87 ; CHECK-NEXT: jb
     88 define void @cmp_jb(i32 %n) {
     89 entry:
     90   br label %loop2a
     91 
     92 loop2a:                                           ; preds = %loop1, %body, %entry
     93   %var = phi i32 [ 0, %entry ], [ %next.var, %loop1 ], [ %var2, %loop2b ]
     94   %next.ptr = phi i32** [ null, %entry ], [ %next.ptr, %loop1 ], [ %gep, %loop2b ]
     95   br label %loop1
     96 
     97 loop1:                                            ; preds = %loop2a, %loop2b
     98   %var2 = sub i32 %var, 1
     99   %cond = icmp ult i32 %var2, %n
    100   %next.load = load i32*, i32** %next.ptr
    101   %next.var = load i32, i32* %next.load
    102   br i1 %cond, label %loop2a, label %loop2b
    103 
    104 loop2b:                                           ; preds = %loop1
    105   %gep = getelementptr inbounds i32*, i32** %next.ptr, i32 1
    106   store i32* %next.load, i32** undef
    107   br label %loop2a
    108 }
    109