• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2 %s -o - | FileCheck %s
2
3define i64 @f1(i64 %a, i64 %b) {
4; CHECK: f1
5; CHECK: subs r0, r0, r2
6    %tmp = sub i64 %a, %b
7    ret i64 %tmp
8}
9
10; 734439407618 = 0x000000ab00000002
11define i64 @f2(i64 %a) {
12; CHECK: f2
13; CHECK: subs r0, #2
14; CHECK: sbc r1, r1, #171
15    %tmp = sub i64 %a, 734439407618
16    ret i64 %tmp
17}
18
19; 5066626890203138 = 0x0012001200000002
20define i64 @f3(i64 %a) {
21; CHECK: f3
22; CHECK: subs  r0, #2
23; CHECK: sbc r1, r1, #1179666
24    %tmp = sub i64 %a, 5066626890203138
25    ret i64 %tmp
26}
27
28; 3747052064576897026 = 0x3400340000000002
29define i64 @f4(i64 %a) {
30; CHECK: f4
31; CHECK: subs  r0, #2
32; CHECK: sbc r1, r1, #872428544
33    %tmp = sub i64 %a, 3747052064576897026
34    ret i64 %tmp
35}
36
37; 6221254862626095106 = 0x5656565600000002
38define i64 @f5(i64 %a) {
39; CHECK: f5
40; CHECK: subs  r0, #2
41; CHECK: adc r1, r1, #-1448498775
42    %tmp = sub i64 %a, 6221254862626095106
43    ret i64 %tmp
44}
45
46; 287104476244869122 = 0x03fc000000000002
47define i64 @f6(i64 %a) {
48; CHECK: f6
49; CHECK: subs  r0, #2
50; CHECK: sbc r1, r1, #66846720
51    %tmp = sub i64 %a, 287104476244869122
52    ret i64 %tmp
53}
54
55; Example from numerics code that manually computes wider-than-64 values.
56;
57; CHECK-LABEL: livecarry:
58; CHECK: adds
59; CHECK: adc
60define i64 @livecarry(i64 %carry, i32 %digit) nounwind {
61  %ch = lshr i64 %carry, 32
62  %cl = and i64 %carry, 4294967295
63  %truncdigit = zext i32 %digit to i64
64  %prod = add i64 %cl, %truncdigit
65  %ph = lshr i64 %prod, 32
66  %carryresult = add i64 %ch, %ph
67  ret i64 %carryresult
68}
69