File: attr_llvmFMF.d

package info (click to toggle)
ldc 1%3A1.24.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 53,728 kB
  • sloc: cpp: 55,939; ansic: 10,599; sh: 958; makefile: 801; asm: 507; objc: 122; exp: 30; python: 12
file content (57 lines) | stat: -rw-r--r-- 1,351 bytes parent folder | download | duplicates (4)
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
// Test @ldc.attributes.llvmFastMathFlag UDA

// RUN: %ldc -c -output-ll -of=%t.ll %s && FileCheck %s --check-prefix LLVM < %t.ll
// RUN: not %ldc -c -w -d-version=WARNING %s 2>&1 | FileCheck %s --check-prefix WARNING

import ldc.attributes;

version(WARNING)
{
    // WARNING: attr_llvmFMF.d(11): Warning: ignoring unrecognized flag parameter `unrecognized` for `@ldc.attributes.llvmFastMathFlag`
    @llvmFastMathFlag("unrecognized")
    void foo() {}
}

// LLVM-LABEL: define{{.*}} @notfast
// LLVM-SAME: #[[ATTR_NOTFAST:[0-9]+]]
extern (C) double notfast(double a, double b)
{
    @llvmFastMathFlag("fast")
    double nested_fast(double a, double b)
    {
        return a * b;
    }

// LLVM: fmul double
    return a * b;
}
// LLVM-LABEL: define{{.*}} @{{.*}}nested_fast
// LLVM: fmul fast double

// LLVM-LABEL: define{{.*}} @{{.*}}nnan_arcp
@llvmFastMathFlag("nnan")
@llvmFastMathFlag("arcp")
double nnan_arcp(double a, double b)
{
// LLVM: fmul nnan arcp double
    return a * b;
}

// LLVM-LABEL: define{{.*}} @{{.*}}ninf_nsz
@llvmFastMathFlag("ninf")
@llvmFastMathFlag("nsz")
double ninf_nsz(double a, double b)
{
// LLVM: fmul ninf nsz double
    return a * b;
}

// LLVM-LABEL: define{{.*}} @{{.*}}cleared
@llvmFastMathFlag("ninf")
@llvmFastMathFlag("clear")
double cleared(double a, double b)
{
// LLVM: fmul double
    return a * b;
}