2014-04-20 00:45:44 +02:00
|
|
|
; RUN: llc < %s -mcpu=atom -march=x86-64 | FileCheck %s
|
2014-04-18 19:22:19 +02:00
|
|
|
|
|
|
|
target triple = "x86_64-unknown-linux-gnu"
|
2013-03-04 19:13:57 +01:00
|
|
|
|
|
|
|
; Additional tests for 64-bit divide bypass
|
|
|
|
|
|
|
|
define i64 @Test_get_quotient(i64 %a, i64 %b) nounwind {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: Test_get_quotient:
|
2013-06-17 21:00:36 +02:00
|
|
|
; CHECK: movq %rdi, %rax
|
|
|
|
; CHECK: orq %rsi, %rax
|
|
|
|
; CHECK-NEXT: testq $-65536, %rax
|
2013-03-04 19:13:57 +01:00
|
|
|
; CHECK-NEXT: je
|
|
|
|
; CHECK: idivq
|
|
|
|
; CHECK: ret
|
|
|
|
; CHECK: divw
|
|
|
|
; CHECK: ret
|
|
|
|
%result = sdiv i64 %a, %b
|
|
|
|
ret i64 %result
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @Test_get_remainder(i64 %a, i64 %b) nounwind {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: Test_get_remainder:
|
2013-06-17 21:00:36 +02:00
|
|
|
; CHECK: movq %rdi, %rax
|
|
|
|
; CHECK: orq %rsi, %rax
|
|
|
|
; CHECK-NEXT: testq $-65536, %rax
|
2013-03-04 19:13:57 +01:00
|
|
|
; CHECK-NEXT: je
|
|
|
|
; CHECK: idivq
|
|
|
|
; CHECK: ret
|
|
|
|
; CHECK: divw
|
|
|
|
; CHECK: ret
|
|
|
|
%result = srem i64 %a, %b
|
|
|
|
ret i64 %result
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @Test_get_quotient_and_remainder(i64 %a, i64 %b) nounwind {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: Test_get_quotient_and_remainder:
|
2013-06-17 21:00:36 +02:00
|
|
|
; CHECK: movq %rdi, %rax
|
|
|
|
; CHECK: orq %rsi, %rax
|
|
|
|
; CHECK-NEXT: testq $-65536, %rax
|
2013-03-04 19:13:57 +01:00
|
|
|
; CHECK-NEXT: je
|
|
|
|
; CHECK: idivq
|
|
|
|
; CHECK: divw
|
|
|
|
; CHECK: addq
|
|
|
|
; CHECK: ret
|
|
|
|
; CHECK-NOT: idivq
|
|
|
|
; CHECK-NOT: divw
|
|
|
|
%resultdiv = sdiv i64 %a, %b
|
|
|
|
%resultrem = srem i64 %a, %b
|
|
|
|
%result = add i64 %resultdiv, %resultrem
|
|
|
|
ret i64 %result
|
|
|
|
}
|