aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/atom-idiv-bypass.c
blob: 596e18b01c2c1ed1445681dfe72cb264c7f52400 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// This test verifies that IDIV bypass optimizations is used when compiling for
// Atom processors with O2. The optimization inserts a test followed by a
// branch to bypass the slow IDIV instruction. This test verifies that global
// context types are used when comparing with those in the BypassTypeMap.

// RUN: %clang_cc1 %s -march=atom -m32 -O2 -S -o - | FileCheck %s
// CHECK: div32
// CHECK: orl
// CHECK: testl
// CHECK: je
// CHECK: idivl
// CHECK: ret
// CHECK: divb
// CHECK: ret
int div32(int a, int b)
{
  return a/b;
}

// CHECK: divrem32
// CHECK: orl
// CHECK: testl
// CHECK: je
// CHECK: idivl
// CHECK: jmp
// CHECK: divb
// CHECK: addl
// CHECK: ret
int divrem32(int a, int b)
{
  return a/b + a%b;
}