1; RUN: llc -mtriple=x86_64-- < %s -pre-RA-sched=list-ilp | FileCheck %s 2; RUN: llc -mtriple=x86_64-- < %s -pre-RA-sched=list-hybrid | FileCheck %s 3; RUN: llc -mtriple=x86_64-- < %s -pre-RA-sched=source | FileCheck %s 4; RUN: llc -mtriple=x86_64-- < %s -pre-RA-sched=list-burr | FileCheck %s 5; RUN: llc -mtriple=x86_64-- < %s -pre-RA-sched=linearize | FileCheck %s 6 7; PR22304 https://llvm.org/bugs/show_bug.cgi?id=22304 8; Tests checking backtracking in source scheduler. llc used to crash on them. 9 10; CHECK-LABEL: test1 11define i256 @test1(i256 %a) { 12 %b = add i256 %a, 1 13 %m = shl i256 %b, 1 14 %p = add i256 %m, 1 15 %v = lshr i256 %b, %p 16 %t = trunc i256 %v to i1 17 %c = shl i256 1, %p 18 %f = select i1 %t, i256 undef, i256 %c 19 ret i256 %f 20} 21 22; CHECK-LABEL: test2 23define i256 @test2(i256 %a) { 24 %b = sub i256 0, %a 25 %c = and i256 %b, %a 26 %d = call i256 @llvm.ctlz.i256(i256 %c, i1 false) 27 ret i256 %d 28} 29 30; CHECK-LABEL: test3 31define i256 @test3(i256 %n) { 32 %m = sub i256 -1, %n 33 %x = sub i256 0, %n 34 %y = and i256 %x, %m 35 %z = call i256 @llvm.ctlz.i256(i256 %y, i1 false) 36 ret i256 %z 37} 38 39declare i256 @llvm.ctlz.i256(i256, i1) nounwind readnone 40 41; CHECK-LABEL: test4 42define i64 @test4(i64 %a, i64 %b) { 43 %r = zext i64 %b to i256 44 %u = add i256 %r, 1 45 %w = and i256 %u, 1461501637330902918203684832716283019655932542975 46 %x = zext i64 %a to i256 47 %c = icmp uge i256 %w, %x 48 %y = select i1 %c, i64 0, i64 1 49 %z = add i64 %y, 1 50 ret i64 %z 51} 52