1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
4 @_ZL11DIGIT_TABLE = dso_local constant [201 x i8] c"00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899\00", align 16
6 define dso_local void @_Z12d2s_bufferedmPc(i64 %arg, ptr nocapture %arg1) {
7 ; CHECK-LABEL: _Z12d2s_bufferedmPc:
8 ; CHECK: # %bb.0: # %bb
9 ; CHECK-NEXT: cmpq $10000, %rdi # imm = 0x2710
10 ; CHECK-NEXT: jb .LBB0_3
11 ; CHECK-NEXT: # %bb.1: # %bb2.preheader
12 ; CHECK-NEXT: xorl %ecx, %ecx
13 ; CHECK-NEXT: movabsq $3777893186295716171, %r8 # imm = 0x346DC5D63886594B
14 ; CHECK-NEXT: .p2align 4, 0x90
15 ; CHECK-NEXT: .LBB0_2: # %bb2
16 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
17 ; CHECK-NEXT: movq %rdi, %rax
18 ; CHECK-NEXT: mulq %r8
19 ; CHECK-NEXT: shrq $11, %rdx
20 ; CHECK-NEXT: imulq $10000, %rdx, %rax # imm = 0x2710
21 ; CHECK-NEXT: movq %rdi, %r9
22 ; CHECK-NEXT: subq %rax, %r9
23 ; CHECK-NEXT: imulq $42949673, %r9, %rax # imm = 0x28F5C29
24 ; CHECK-NEXT: shrq $32, %rax
25 ; CHECK-NEXT: imull $100, %eax, %r10d
26 ; CHECK-NEXT: subl %r10d, %r9d
27 ; CHECK-NEXT: movl %ecx, %r10d
28 ; CHECK-NEXT: movq %rsi, %r11
29 ; CHECK-NEXT: subq %r10, %r11
30 ; CHECK-NEXT: movzwl _ZL11DIGIT_TABLE(%r9,%r9), %r9d
31 ; CHECK-NEXT: movw %r9w, -1(%r11)
32 ; CHECK-NEXT: movzwl _ZL11DIGIT_TABLE(%rax,%rax), %eax
33 ; CHECK-NEXT: movw %ax, -3(%r11)
34 ; CHECK-NEXT: addl $4, %ecx
35 ; CHECK-NEXT: cmpq $99999999, %rdi # imm = 0x5F5E0FF
36 ; CHECK-NEXT: movq %rdx, %rdi
37 ; CHECK-NEXT: ja .LBB0_2
38 ; CHECK-NEXT: .LBB0_3: # %bb29
41 %i = icmp ugt i64 %arg, 9999
42 br i1 %i, label %bb2, label %bb29
44 bb2: ; preds = %bb2, %bb
45 %i3 = phi i64 [ %i7, %bb2 ], [ %arg, %bb ]
46 %i4 = phi i32 [ %i27, %bb2 ], [ 0, %bb ]
47 %i5 = urem i64 %i3, 10000
48 %i6 = trunc i64 %i5 to i32
49 %i7 = udiv i64 %i3, 10000
50 %i8 = urem i32 %i6, 100
51 %i9 = shl nuw nsw i32 %i8, 1
52 %i10 = udiv i32 %i6, 100
53 %i11 = shl nuw nsw i32 %i10, 1
54 %i12 = zext i32 %i4 to i64
55 %i13 = sub nsw i64 0, %i12
56 %i14 = getelementptr inbounds i8, ptr %arg1, i64 %i13
57 %i15 = getelementptr inbounds i8, ptr %i14, i64 -1
58 %i16 = zext i32 %i9 to i64
59 %i17 = getelementptr inbounds [201 x i8], ptr @_ZL11DIGIT_TABLE, i64 0, i64 %i16
60 %i20 = load i16, ptr %i17, align 2
61 store i16 %i20, ptr %i15, align 1
62 %i21 = getelementptr inbounds i8, ptr %i14, i64 -3
63 %i22 = zext i32 %i11 to i64
64 %i23 = getelementptr inbounds [201 x i8], ptr @_ZL11DIGIT_TABLE, i64 0, i64 %i22
65 %i26 = load i16, ptr %i23, align 2
66 store i16 %i26, ptr %i21, align 1
68 %i28 = icmp ugt i64 %i3, 99999999
69 br i1 %i28, label %bb2, label %bb29
71 bb29: ; preds = %bb2, %bb