File: ppc64-f128-builtins.c

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (63 lines) | stat: -rw-r--r-- 2,246 bytes parent folder | download
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// RUN: %clang_cc1 -no-opaque-pointers -triple powerpc64le-linux-gnu -emit-llvm -o - %s \
// RUN:   -mabi=ieeelongdouble | FileCheck --check-prefix=IEEE128 %s
// RUN: %clang_cc1 -no-opaque-pointers -triple powerpc64le-linux-gnu -emit-llvm -o - %s \
// RUN:   | FileCheck --check-prefix=PPC128 %s

long double x;
char buf[20];

// IEEE128-LABEL: define dso_local void @test_printf
// IEEE128: call signext i32 (i8*, ...) @__printfieee128
// PPC128-LABEL: define dso_local void @test_printf
// PPC128: call signext i32 (i8*, ...) @printf
void test_printf(void) {
  __builtin_printf("%.Lf", x);
}

// IEEE128-LABEL: define dso_local void @test_vsnprintf
// IEEE128: call signext i32 @__vsnprintfieee128
// PPC128-LABEL: define dso_local void @test_vsnprintf
// PPC128: call signext i32 @vsnprintf
void test_vsnprintf(int n, ...) {
  __builtin_va_list va;
  __builtin_va_start(va, n);
  __builtin_vsnprintf(buf, 20, "%.Lf", va);
  __builtin_va_end(va);
}

// IEEE128-LABEL: define dso_local void @test_vsprintf
// IEEE128: call signext i32 @__vsprintfieee128
// PPC128-LABEL: define dso_local void @test_vsprintf
// PPC128: call signext i32 @vsprintf
void test_vsprintf(int n, ...) {
  __builtin_va_list va;
  __builtin_va_start(va, n);
  __builtin_vsprintf(buf, "%.Lf", va);
  __builtin_va_end(va);
}

// IEEE128-LABEL: define dso_local void @test_sprintf
// IEEE128: call signext i32 (i8*, i8*, ...) @__sprintfieee128
// PPC128-LABEL: define dso_local void @test_sprintf
// PPC128: call signext i32 (i8*, i8*, ...) @sprintf
void test_sprintf(void) {
  __builtin_sprintf(buf, "%.Lf", x);
}

// IEEE128-LABEL: define dso_local void @test_snprintf
// IEEE128: call signext i32 (i8*, i64, i8*, ...) @__snprintfieee128
// PPC128-LABEL: define dso_local void @test_snprintf
// PPC128: call signext i32 (i8*, i64, i8*, ...) @snprintf
void test_snprintf(void) {
  __builtin_snprintf(buf, 20, "%.Lf", x);
}

// GLIBC has special handling of 'nexttoward'

// IEEE128-LABEL: define dso_local fp128 @test_nexttoward
// IEEE128: call fp128 @__nexttowardieee128
// PPC128-LABEL: define dso_local ppc_fp128 @test_nexttoward
// PPC128: call ppc_fp128 @nexttowardl
long double test_nexttoward(long double a, long double b) {
  return __builtin_nexttowardl(a, b);
}