1 ; RUN: llc < %s -mtriple=arm64-eabi -O0 -verify-machineinstrs | FileCheck %s
2 ; RUN: llc < %s -mtriple=arm64-eabi -O3 -verify-machineinstrs | FileCheck %s
4 @.str = private unnamed_addr constant [9 x i8] c"%lf %lu\0A\00", align 1
5 @.str1 = private unnamed_addr constant [8 x i8] c"%lf %u\0A\00", align 1
6 @.str2 = private unnamed_addr constant [8 x i8] c"%f %lu\0A\00", align 1
7 @.str3 = private unnamed_addr constant [7 x i8] c"%f %u\0A\00", align 1
9 define void @testDouble(double %d) ssp {
10 ; CHECK-LABEL: testDouble:
11 ; CHECK: fcvtzu x{{[0-9]+}}, d{{[0-9]+}}
12 ; CHECK: fcvtzu w{{[0-9]+}}, d{{[0-9]+}}
14 %d.addr = alloca double, align 8
15 store double %d, double* %d.addr, align 8
16 %0 = load double, double* %d.addr, align 8
17 %1 = load double, double* %d.addr, align 8
18 %conv = fptoui double %1 to i64
19 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), double %0, i64 %conv)
20 %2 = load double, double* %d.addr, align 8
21 %3 = load double, double* %d.addr, align 8
22 %conv1 = fptoui double %3 to i32
23 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str1, i32 0, i32 0), double %2, i32 %conv1)
27 declare i32 @printf(i8*, ...)
29 define void @testFloat(float %f) ssp {
30 ; CHECK-LABEL: testFloat:
31 ; CHECK: fcvtzu x{{[0-9]+}}, s{{[0-9]+}}
32 ; CHECK: fcvtzu w{{[0-9]+}}, s{{[0-9]+}}
34 %f.addr = alloca float, align 4
35 store float %f, float* %f.addr, align 4
36 %0 = load float, float* %f.addr, align 4
37 %conv = fpext float %0 to double
38 %1 = load float, float* %f.addr, align 4
39 %conv1 = fptoui float %1 to i64
40 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str2, i32 0, i32 0), double %conv, i64 %conv1)
41 %2 = load float, float* %f.addr, align 4
42 %conv2 = fpext float %2 to double
43 %3 = load float, float* %f.addr, align 4
44 %conv3 = fptoui float %3 to i32
45 %call4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str3, i32 0, i32 0), double %conv2, i32 %conv3)
49 define i32 @main(i32 %argc, i8** %argv) ssp {
51 %retval = alloca i32, align 4
52 %argc.addr = alloca i32, align 4
53 %argv.addr = alloca i8**, align 8
54 store i32 0, i32* %retval
55 store i32 %argc, i32* %argc.addr, align 4
56 store i8** %argv, i8*** %argv.addr, align 8
57 call void @testDouble(double 1.159198e+01)
58 call void @testFloat(float 0x40272F1800000000)
62 !llvm.module.flags = !{!0, !1, !2, !3}
64 !0 = !{i32 1, !"Objective-C Version", i32 2}
65 !1 = !{i32 1, !"Objective-C Image Info Version", i32 0}
66 !2 = !{i32 1, !"Objective-C Image Info Section", !"__DATA, __objc_imageinfo, regular, no_dead_strip"}
67 !3 = !{i32 4, !"Objective-C Garbage Collection", i32 0}