1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86-64 -mcpu=core2 -x86-early-ifcvt -enable-misched \ 2*9880d681SAndroid Build Coastguard Worker; RUN: -misched=shuffle -misched-bottomup -verify-machineinstrs \ 3*9880d681SAndroid Build Coastguard Worker; RUN: | FileCheck %s 4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86-64 -mcpu=core2 -x86-early-ifcvt -enable-misched \ 5*9880d681SAndroid Build Coastguard Worker; RUN: -misched=shuffle -misched-topdown -verify-machineinstrs \ 6*9880d681SAndroid Build Coastguard Worker; RUN: | FileCheck %s --check-prefix TOPDOWN 7*9880d681SAndroid Build Coastguard Worker; REQUIRES: asserts 8*9880d681SAndroid Build Coastguard Worker; 9*9880d681SAndroid Build Coastguard Worker; Interesting MachineScheduler cases. 10*9880d681SAndroid Build Coastguard Worker; 11*9880d681SAndroid Build Coastguard Worker; FIXME: There should be an assert in the coalescer that we're not rematting 12*9880d681SAndroid Build Coastguard Worker; "not-quite-dead" copies, but that breaks a lot of tests <rdar://problem/11148682>. 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Worker; From oggenc. 17*9880d681SAndroid Build Coastguard Worker; After coalescing, we have a dead superreg (RAX) definition. 18*9880d681SAndroid Build Coastguard Worker; 19*9880d681SAndroid Build Coastguard Worker; CHECK: xorl %esi, %esi 20*9880d681SAndroid Build Coastguard Worker; CHECK: movl $32, %ecx 21*9880d681SAndroid Build Coastguard Worker; CHECK: rep;movsl 22*9880d681SAndroid Build Coastguard Workerdefine fastcc void @_preextrapolate_helper() nounwind uwtable ssp { 23*9880d681SAndroid Build Coastguard Workerentry: 24*9880d681SAndroid Build Coastguard Worker br i1 undef, label %for.cond.preheader, label %if.end 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Workerfor.cond.preheader: ; preds = %entry 27*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* undef, i8* null, i64 128, i32 4, i1 false) nounwind 28*9880d681SAndroid Build Coastguard Worker unreachable 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Workerif.end: ; preds = %entry 31*9880d681SAndroid Build Coastguard Worker ret void 32*9880d681SAndroid Build Coastguard Worker} 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Worker; The machine verifier checks that EFLAGS kill flags are updated when 35*9880d681SAndroid Build Coastguard Worker; the scheduler reorders cmovel instructions. 36*9880d681SAndroid Build Coastguard Worker; 37*9880d681SAndroid Build Coastguard Worker; CHECK: test 38*9880d681SAndroid Build Coastguard Worker; CHECK: cmovel 39*9880d681SAndroid Build Coastguard Worker; CHECK: cmovel 40*9880d681SAndroid Build Coastguard Worker; CHECK: call 41*9880d681SAndroid Build Coastguard Workerdefine void @foo(i32 %b) nounwind uwtable ssp { 42*9880d681SAndroid Build Coastguard Workerentry: 43*9880d681SAndroid Build Coastguard Worker %tobool = icmp ne i32 %b, 0 44*9880d681SAndroid Build Coastguard Worker br i1 %tobool, label %if.then, label %if.end 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Workerif.then: ; preds = %entry 47*9880d681SAndroid Build Coastguard Worker br label %if.end 48*9880d681SAndroid Build Coastguard Worker 49*9880d681SAndroid Build Coastguard Workerif.end: ; preds = %if.then, %entry 50*9880d681SAndroid Build Coastguard Worker %v1 = phi i32 [1, %entry], [2, %if.then] 51*9880d681SAndroid Build Coastguard Worker %v2 = phi i32 [3, %entry], [4, %if.then] 52*9880d681SAndroid Build Coastguard Worker call void @bar(i32 %v1, i32 %v2) 53*9880d681SAndroid Build Coastguard Worker ret void 54*9880d681SAndroid Build Coastguard Worker} 55*9880d681SAndroid Build Coastguard Worker 56*9880d681SAndroid Build Coastguard Workerdeclare void @bar(i32,i32) 57*9880d681SAndroid Build Coastguard Worker 58*9880d681SAndroid Build Coastguard Worker; Test that the DAG builder can handle an undef vreg on ExitSU. 59*9880d681SAndroid Build Coastguard Worker; CHECK: hasundef 60*9880d681SAndroid Build Coastguard Worker; CHECK: call 61*9880d681SAndroid Build Coastguard Worker 62*9880d681SAndroid Build Coastguard Worker%t0 = type { i32, i32, i8 } 63*9880d681SAndroid Build Coastguard Worker%t6 = type { i32 (...)**, %t7* } 64*9880d681SAndroid Build Coastguard Worker%t7 = type { i32 (...)** } 65*9880d681SAndroid Build Coastguard Worker 66*9880d681SAndroid Build Coastguard Workerdefine void @hasundef() unnamed_addr uwtable ssp align 2 { 67*9880d681SAndroid Build Coastguard Worker %1 = alloca %t0, align 8 68*9880d681SAndroid Build Coastguard Worker br i1 undef, label %3, label %2 69*9880d681SAndroid Build Coastguard Worker 70*9880d681SAndroid Build Coastguard Worker; <label>:2 ; preds = %0 71*9880d681SAndroid Build Coastguard Worker unreachable 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Worker; <label>:3 ; preds = %0 74*9880d681SAndroid Build Coastguard Worker br i1 undef, label %4, label %5 75*9880d681SAndroid Build Coastguard Worker 76*9880d681SAndroid Build Coastguard Worker; <label>:4 ; preds = %3 77*9880d681SAndroid Build Coastguard Worker call void undef(%t6* undef, %t0* %1) 78*9880d681SAndroid Build Coastguard Worker unreachable 79*9880d681SAndroid Build Coastguard Worker 80*9880d681SAndroid Build Coastguard Worker; <label>:5 ; preds = %3 81*9880d681SAndroid Build Coastguard Worker ret void 82*9880d681SAndroid Build Coastguard Worker} 83*9880d681SAndroid Build Coastguard Worker 84*9880d681SAndroid Build Coastguard Worker; Test top-down subregister liveness tracking. Self-verification 85*9880d681SAndroid Build Coastguard Worker; catches any pressure set underflow. 86*9880d681SAndroid Build Coastguard Worker; rdar://12797931. 87*9880d681SAndroid Build Coastguard Worker; 88*9880d681SAndroid Build Coastguard Worker; TOPDOWN: @testSubregTracking 89*9880d681SAndroid Build Coastguard Worker; TOPDOWN: divb 90*9880d681SAndroid Build Coastguard Worker; TOPDOWN: movzbl %al 91*9880d681SAndroid Build Coastguard Worker; TOPDOWN: ret 92*9880d681SAndroid Build Coastguard Workerdefine void @testSubregTracking() nounwind uwtable ssp align 2 { 93*9880d681SAndroid Build Coastguard Worker %tmp = load i8, i8* undef, align 1 94*9880d681SAndroid Build Coastguard Worker %tmp6 = sub i8 0, %tmp 95*9880d681SAndroid Build Coastguard Worker %tmp7 = load i8, i8* undef, align 1 96*9880d681SAndroid Build Coastguard Worker %tmp8 = udiv i8 %tmp6, %tmp7 97*9880d681SAndroid Build Coastguard Worker %tmp9 = zext i8 %tmp8 to i64 98*9880d681SAndroid Build Coastguard Worker %tmp10 = load i8, i8* undef, align 1 99*9880d681SAndroid Build Coastguard Worker %tmp11 = zext i8 %tmp10 to i64 100*9880d681SAndroid Build Coastguard Worker %tmp12 = mul i64 %tmp11, %tmp9 101*9880d681SAndroid Build Coastguard Worker %tmp13 = urem i8 %tmp6, %tmp7 102*9880d681SAndroid Build Coastguard Worker %tmp14 = zext i8 %tmp13 to i32 103*9880d681SAndroid Build Coastguard Worker %tmp15 = add nsw i32 %tmp14, 0 104*9880d681SAndroid Build Coastguard Worker %tmp16 = add i32 %tmp15, 0 105*9880d681SAndroid Build Coastguard Worker store i32 %tmp16, i32* undef, align 4 106*9880d681SAndroid Build Coastguard Worker %tmp17 = add i64 0, %tmp12 107*9880d681SAndroid Build Coastguard Worker store i64 %tmp17, i64* undef, align 8 108*9880d681SAndroid Build Coastguard Worker ret void 109*9880d681SAndroid Build Coastguard Worker} 110