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 = constant [201 x i8] c"00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899\00", align 16
6 define void @_Z12d2s_bufferedmPc(i64, i8* nocapture) {
7 ; CHECK-LABEL: _Z12d2s_bufferedmPc:
9 ; CHECK-NEXT: cmpq $10000, %rdi # imm = 0x2710
10 ; CHECK-NEXT: jb .LBB0_3
11 ; CHECK-NEXT: # %bb.1: # %.preheader
12 ; CHECK-NEXT: movq %rdi, %r9
13 ; CHECK-NEXT: xorl %r10d, %r10d
14 ; CHECK-NEXT: movabsq $3777893186295716171, %r8 # imm = 0x346DC5D63886594B
15 ; CHECK-NEXT: .p2align 4, 0x90
16 ; CHECK-NEXT: .LBB0_2: # =>This Inner Loop Header: Depth=1
17 ; CHECK-NEXT: movq %r9, %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 %r9, %rdi
22 ; CHECK-NEXT: subq %rax, %rdi
23 ; CHECK-NEXT: imulq $1374389535, %rdi, %rax # imm = 0x51EB851F
24 ; CHECK-NEXT: shrq $37, %rax
25 ; CHECK-NEXT: imull $100, %eax, %ecx
26 ; CHECK-NEXT: subl %ecx, %edi
27 ; CHECK-NEXT: movl %r10d, %r11d
28 ; CHECK-NEXT: movq %rsi, %rcx
29 ; CHECK-NEXT: subq %r11, %rcx
30 ; CHECK-NEXT: movzwl _ZL11DIGIT_TABLE(%rdi,%rdi), %edi
31 ; CHECK-NEXT: movw %di, -1(%rcx)
32 ; CHECK-NEXT: movzwl _ZL11DIGIT_TABLE(%rax,%rax), %eax
33 ; CHECK-NEXT: movw %ax, -3(%rcx)
34 ; CHECK-NEXT: addl $4, %r10d
35 ; CHECK-NEXT: cmpq $99999999, %r9 # imm = 0x5F5E0FF
36 ; CHECK-NEXT: movq %rdx, %r9
37 ; CHECK-NEXT: ja .LBB0_2
38 ; CHECK-NEXT: .LBB0_3:
40 %3 = icmp ugt i64 %0, 9999
41 br i1 %3, label %4, label %31
43 ; <label>:4: ; preds = %2, %4
44 %5 = phi i64 [ %9, %4 ], [ %0, %2 ]
45 %6 = phi i32 [ %29, %4 ], [ 0, %2 ]
46 %7 = urem i64 %5, 10000
47 %8 = trunc i64 %7 to i32
48 %9 = udiv i64 %5, 10000
49 %10 = urem i32 %8, 100
50 %11 = shl nuw nsw i32 %10, 1
51 %12 = udiv i32 %8, 100
52 %13 = shl nuw nsw i32 %12, 1
53 %14 = zext i32 %6 to i64
54 %15 = sub nsw i64 0, %14
55 %16 = getelementptr inbounds i8, i8* %1, i64 %15
56 %17 = getelementptr inbounds i8, i8* %16, i64 -1
57 %18 = zext i32 %11 to i64
58 %19 = getelementptr inbounds [201 x i8], [201 x i8]* @_ZL11DIGIT_TABLE, i64 0, i64 %18
59 %20 = bitcast i8* %19 to i16*
60 %21 = bitcast i8* %17 to i16*
61 %22 = load i16, i16* %20, align 2
62 store i16 %22, i16* %21, align 1
63 %23 = getelementptr inbounds i8, i8* %16, i64 -3
64 %24 = zext i32 %13 to i64
65 %25 = getelementptr inbounds [201 x i8], [201 x i8]* @_ZL11DIGIT_TABLE, i64 0, i64 %24
66 %26 = bitcast i8* %25 to i16*
67 %27 = bitcast i8* %23 to i16*
68 %28 = load i16, i16* %26, align 2
69 store i16 %28, i16* %27, align 1
71 %30 = icmp ugt i64 %5, 99999999
72 br i1 %30, label %4, label %31
74 ; <label>:31: ; preds = %4, %2