| 1 |
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py |
| 2 |
|
| 3 |
// RUN: %clang_cc1 \ |
| 4 |
// RUN: -internal-isystem %S/../../lib/Headers/cuda_wrappers \ |
| 5 |
// RUN: -internal-isystem %S/Inputs/include \ |
| 6 |
// RUN: -triple x86_64-unknown-unknown \ |
| 7 |
// RUN: -emit-llvm %s -O1 -o - \ |
| 8 |
// RUN: | FileCheck %s |
| 9 |
|
| 10 |
#define __host__ __attribute__((host)) |
| 11 |
#define __device__ __attribute__((device)) |
| 12 |
|
| 13 |
#include <algorithm> |
| 14 |
|
| 15 |
extern "C" bool cmp(double a, double b) { return a<b; } |
| 16 |
|
| 17 |
// CHECK-LABEL: @test_std_min( |
| 18 |
// CHECK-NEXT: entry: |
| 19 |
// CHECK-NEXT: ret double 0x7FF8000000000000 |
| 20 |
// |
| 21 |
extern "C" double test_std_min() { |
| 22 |
return std::min(__builtin_nan(""), 0.0); |
| 23 |
} |
| 24 |
|
| 25 |
// CHECK-LABEL: @test_std_min_cmp( |
| 26 |
// CHECK-NEXT: entry: |
| 27 |
// CHECK-NEXT: ret double 0x7FF8000000000000 |
| 28 |
// |
| 29 |
extern "C" double test_std_min_cmp() { |
| 30 |
return std::min(__builtin_nan(""), 0.0, cmp); |
| 31 |
} |
| 32 |
|
| 33 |
// CHECK-LABEL: @test_std_max( |
| 34 |
// CHECK-NEXT: entry: |
| 35 |
// CHECK-NEXT: ret double 0x7FF8000000000000 |
| 36 |
// |
| 37 |
extern "C" double test_std_max() { |
| 38 |
return std::max(__builtin_nan(""), 0.0); |
| 39 |
} |
| 40 |
|
| 41 |
// CHECK-LABEL: @test_std_max_cmp( |
| 42 |
// CHECK-NEXT: entry: |
| 43 |
// CHECK-NEXT: ret double 0x7FF8000000000000 |
| 44 |
// |
| 45 |
extern "C" double test_std_max_cmp() { |
| 46 |
return std::max(__builtin_nan(""), 0.0, cmp); |
| 47 |
} |
| 48 |
|