1 ; RUN: llc < %s -mcpu=atom -mtriple=i686-linux -march=x86-64 | FileCheck %s 2 3 ; Additional tests for 64-bit divide bypass 4 5 define i64 @Test_get_quotient(i64 %a, i64 %b) nounwind { 6 ; CHECK-LABEL: Test_get_quotient: 7 ; CHECK: movq %rdi, %rax 8 ; CHECK: orq %rsi, %rax 9 ; CHECK-NEXT: testq $-65536, %rax 10 ; CHECK-NEXT: je 11 ; CHECK: idivq 12 ; CHECK: ret 13 ; CHECK: divw 14 ; CHECK: ret 15 %result = sdiv i64 %a, %b 16 ret i64 %result 17 } 18 19 define i64 @Test_get_remainder(i64 %a, i64 %b) nounwind { 20 ; CHECK-LABEL: Test_get_remainder: 21 ; CHECK: movq %rdi, %rax 22 ; CHECK: orq %rsi, %rax 23 ; CHECK-NEXT: testq $-65536, %rax 24 ; CHECK-NEXT: je 25 ; CHECK: idivq 26 ; CHECK: ret 27 ; CHECK: divw 28 ; CHECK: ret 29 %result = srem i64 %a, %b 30 ret i64 %result 31 } 32 33 define i64 @Test_get_quotient_and_remainder(i64 %a, i64 %b) nounwind { 34 ; CHECK-LABEL: Test_get_quotient_and_remainder: 35 ; CHECK: movq %rdi, %rax 36 ; CHECK: orq %rsi, %rax 37 ; CHECK-NEXT: testq $-65536, %rax 38 ; CHECK-NEXT: je 39 ; CHECK: idivq 40 ; CHECK: divw 41 ; CHECK: addq 42 ; CHECK: ret 43 ; CHECK-NOT: idivq 44 ; CHECK-NOT: divw 45 %resultdiv = sdiv i64 %a, %b 46 %resultrem = srem i64 %a, %b 47 %result = add i64 %resultdiv, %resultrem 48 ret i64 %result 49 } 50