xref: /minix3/external/bsd/llvm/dist/llvm/test/CodeGen/X86/atom-bypass-slow-division-64.ll (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc; RUN: llc < %s -mcpu=atom -march=x86-64 | FileCheck %s
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuctarget triple = "x86_64-unknown-linux-gnu"
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambuc; Additional tests for 64-bit divide bypass
6f4a2713aSLionel Sambuc
7f4a2713aSLionel Sambucdefine i64 @Test_get_quotient(i64 %a, i64 %b) nounwind {
8f4a2713aSLionel Sambuc; CHECK-LABEL: Test_get_quotient:
9f4a2713aSLionel Sambuc; CHECK: movq %rdi, %rax
10f4a2713aSLionel Sambuc; CHECK: orq %rsi, %rax
11f4a2713aSLionel Sambuc; CHECK-NEXT: testq $-65536, %rax
12f4a2713aSLionel Sambuc; CHECK-NEXT: je
13f4a2713aSLionel Sambuc; CHECK: idivq
14f4a2713aSLionel Sambuc; CHECK: ret
15f4a2713aSLionel Sambuc; CHECK: divw
16f4a2713aSLionel Sambuc; CHECK: ret
17f4a2713aSLionel Sambuc  %result = sdiv i64 %a, %b
18f4a2713aSLionel Sambuc  ret i64 %result
19f4a2713aSLionel Sambuc}
20f4a2713aSLionel Sambuc
21f4a2713aSLionel Sambucdefine i64 @Test_get_remainder(i64 %a, i64 %b) nounwind {
22f4a2713aSLionel Sambuc; CHECK-LABEL: Test_get_remainder:
23f4a2713aSLionel Sambuc; CHECK: movq %rdi, %rax
24f4a2713aSLionel Sambuc; CHECK: orq %rsi, %rax
25f4a2713aSLionel Sambuc; CHECK-NEXT: testq $-65536, %rax
26f4a2713aSLionel Sambuc; CHECK-NEXT: je
27f4a2713aSLionel Sambuc; CHECK: idivq
28f4a2713aSLionel Sambuc; CHECK: ret
29f4a2713aSLionel Sambuc; CHECK: divw
30f4a2713aSLionel Sambuc; CHECK: ret
31f4a2713aSLionel Sambuc  %result = srem i64 %a, %b
32f4a2713aSLionel Sambuc  ret i64 %result
33f4a2713aSLionel Sambuc}
34f4a2713aSLionel Sambuc
35f4a2713aSLionel Sambucdefine i64 @Test_get_quotient_and_remainder(i64 %a, i64 %b) nounwind {
36f4a2713aSLionel Sambuc; CHECK-LABEL: Test_get_quotient_and_remainder:
37f4a2713aSLionel Sambuc; CHECK: movq %rdi, %rax
38f4a2713aSLionel Sambuc; CHECK: orq %rsi, %rax
39f4a2713aSLionel Sambuc; CHECK-NEXT: testq $-65536, %rax
40f4a2713aSLionel Sambuc; CHECK-NEXT: je
41f4a2713aSLionel Sambuc; CHECK: idivq
42f4a2713aSLionel Sambuc; CHECK: divw
43f4a2713aSLionel Sambuc; CHECK: addq
44f4a2713aSLionel Sambuc; CHECK: ret
45f4a2713aSLionel Sambuc; CHECK-NOT: idivq
46f4a2713aSLionel Sambuc; CHECK-NOT: divw
47f4a2713aSLionel Sambuc  %resultdiv = sdiv i64 %a, %b
48f4a2713aSLionel Sambuc  %resultrem = srem i64 %a, %b
49f4a2713aSLionel Sambuc  %result = add i64 %resultdiv, %resultrem
50f4a2713aSLionel Sambuc  ret i64 %result
51f4a2713aSLionel Sambuc}
52