| 1 |
// { dg-additional-options -fdump-tree-original } |
| 2 |
|
| 3 |
#![feature(intrinsics)] |
| 4 |
extern "rust-intrinsic" { |
| 5 |
pub fn sqrtf32(x: f32) -> f32; |
| 6 |
pub fn sqrtf64(x: f64) -> f64; |
| 7 |
|
| 8 |
pub fn sinf32(x: f32) -> f32; |
| 9 |
pub fn sinf64(x: f64) -> f64; |
| 10 |
|
| 11 |
pub fn cosf32(x: f32) -> f32; |
| 12 |
pub fn cosf64(x: f64) -> f64; |
| 13 |
|
| 14 |
pub fn powf32(a: f32, x: f32) -> f32; |
| 15 |
pub fn powf64(a: f64, x: f64) -> f64; |
| 16 |
|
| 17 |
pub fn powif32(a: f32, x: i32) -> f32; |
| 18 |
pub fn powif64(a: f64, x: i32) -> f64; |
| 19 |
|
| 20 |
pub fn expf32(x: f32) -> f32; |
| 21 |
pub fn expf64(x: f64) -> f64; |
| 22 |
|
| 23 |
pub fn exp2f32(x: f32) -> f32; |
| 24 |
pub fn exp2f64(x: f64) -> f64; |
| 25 |
|
| 26 |
pub fn logf32(x: f32) -> f32; |
| 27 |
pub fn logf64(x: f64) -> f64; |
| 28 |
|
| 29 |
pub fn log10f32(x: f32) -> f32; |
| 30 |
pub fn log10f64(x: f64) -> f64; |
| 31 |
|
| 32 |
pub fn log2f32(x: f32) -> f32; |
| 33 |
pub fn log2f64(x: f64) -> f64; |
| 34 |
|
| 35 |
pub fn fmaf32(a: f32, b: f32, c: f32) -> f32; |
| 36 |
pub fn fmaf64(a: f64, b: f64, c: f64) -> f64; |
| 37 |
|
| 38 |
pub fn fabsf32(x: f32) -> f32; |
| 39 |
pub fn fabsf64(x: f64) -> f64; |
| 40 |
|
| 41 |
pub fn minnumf32(x: f32, y: f32) -> f32; |
| 42 |
pub fn minnumf64(x: f64, y: f64) -> f64; |
| 43 |
|
| 44 |
pub fn maxnumf32(x: f32, y: f32) -> f32; |
| 45 |
pub fn maxnumf64(x: f64, y: f64) -> f64; |
| 46 |
|
| 47 |
pub fn copysignf32(x: f32, y: f32) -> f32; |
| 48 |
pub fn copysignf64(x: f64, y: f64) -> f64; |
| 49 |
|
| 50 |
pub fn floorf32(x: f32) -> f32; |
| 51 |
pub fn floorf64(x: f64) -> f64; |
| 52 |
|
| 53 |
pub fn ceilf32(x: f32) -> f32; |
| 54 |
pub fn ceilf64(x: f64) -> f64; |
| 55 |
|
| 56 |
pub fn truncf32(x: f32) -> f32; |
| 57 |
pub fn truncf64(x: f64) -> f64; |
| 58 |
|
| 59 |
pub fn rintf32(x: f32) -> f32; |
| 60 |
pub fn rintf64(x: f64) -> f64; |
| 61 |
|
| 62 |
pub fn nearbyintf32(x: f32) -> f32; |
| 63 |
pub fn nearbyintf64(x: f64) -> f64; |
| 64 |
|
| 65 |
pub fn roundf32(x: f32) -> f32; |
| 66 |
pub fn roundf64(x: f64) -> f64; |
| 67 |
} |
| 68 |
|
| 69 |
fn main() { |
| 70 |
unsafe fn foo() { |
| 71 |
let mut f32; |
| 72 |
let mut f64; |
| 73 |
|
| 74 |
f32 = sqrtf32(1f32); |
| 75 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_sqrt. \(.*.*1\.0e\+0\);$} 1 original } } |
| 76 |
f64 = sqrtf64(2f64); |
| 77 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_sqrt.? \(.*2\.0e\+0\);$} 1 original } } |
| 78 |
|
| 79 |
f32 = sinf32(39f32); |
| 80 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_sin. \(.*3\.9e\+1\);$} 1 original } } |
| 81 |
f64 = sinf64(40f64); |
| 82 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_sin.? \(.*4\.0e\+1\);$} 1 original } } |
| 83 |
|
| 84 |
f32 = cosf32(5f32); |
| 85 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_cos. \(.*5\.0e\+0\);$} 1 original } } |
| 86 |
f64 = cosf64(6f64); |
| 87 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_cos.? \(.*6\.0e\+0\);$} 1 original } } |
| 88 |
|
| 89 |
f32 = powf32(7f32, 8f32); |
| 90 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_pow[^i] \(.*7\.0e\+0, .*8\.0e\+0\);$} 1 original } } |
| 91 |
f64 = powf64(9f64, 10f64); |
| 92 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_pow[^i]? \(.*9\.0e\+0, .*1\.0e\+1\);$} 1 original } } |
| 93 |
|
| 94 |
f32 = powif32(7f32, 8i32); |
| 95 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_powi. \(.*7\.0e\+0, .*8\);$} 1 original } } |
| 96 |
f64 = powif64(9f64, 10i32); |
| 97 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_powi.? \(.*9\.0e\+0, .*10\);$} 1 original } } |
| 98 |
|
| 99 |
f32 = expf32(11f32); |
| 100 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_exp. \(.*1\.1e\+1\);$} 1 original } } |
| 101 |
f64 = expf64(12f64); |
| 102 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_exp.? \(.*1\.2e\+1\);$} 1 original } } |
| 103 |
|
| 104 |
f32 = exp2f32(13f32); |
| 105 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_exp. \(.*1\.1e\+1\);$} 1 original } } |
| 106 |
f64 = exp2f64(14f64); |
| 107 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_exp.? \(.*1\.2e\+1\);$} 1 original } } |
| 108 |
|
| 109 |
f32 = logf32(15f32); |
| 110 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_log. \(.*1\.5e\+1\);$} 1 original } } |
| 111 |
f64 = logf64(16f64); |
| 112 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_log.? \(.*1\.6e\+1\);$} 1 original } } |
| 113 |
|
| 114 |
f32 = log10f32(17f32); |
| 115 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_log10. \(.*1\.7e\+1\);$} 1 original } } |
| 116 |
f64 = log10f64(18f64); |
| 117 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_log10.? \(.*1\.8e\+1\);$} 1 original } } |
| 118 |
|
| 119 |
f32 = log2f32(19f32); |
| 120 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_log2. \(.*1\.9e\+1\);$} 1 original } } |
| 121 |
f64 = log2f64(20f64); |
| 122 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_log2.? \(.*2\.0e\+1\);$} 1 original } } |
| 123 |
|
| 124 |
f32 = fmaf32(21f32, 22f32, 23f32); |
| 125 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_fma. \(.*2\.1e\+1, .*2\.2e\+1, .*2\.3e\+1\);$} 1 original } } |
| 126 |
f64 = fmaf64(24f64, 25f64, 26f64); |
| 127 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_fma.? \(.*2\.4e\+1, .*2\.5e\+1, .*2\.6e\+1\);$} 1 original } } |
| 128 |
|
| 129 |
f32 = fabsf32(27f32); |
| 130 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_fabs. \(.*2\.7e\+1\);$} 1 original } } |
| 131 |
f64 = fabsf64(28f64); |
| 132 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_fabs.? \(.*2\.8e\+1\);$} 1 original } } |
| 133 |
|
| 134 |
f32 = minnumf32(29f32, 30f32); |
| 135 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_fmin. \(.*2\.9e\+1, .*3\.0e\+1\);$} 1 original } } |
| 136 |
f64 = minnumf64(31f64, 32f64); |
| 137 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_fmin.? \(.*3\.1e\+1, .*3\.2e\+1\);$} 1 original } } |
| 138 |
|
| 139 |
f32 = maxnumf32(33f32, 34f32); |
| 140 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_fmax. \(.*3\.3e\+1, .*3\.4e\+1\);$} 1 original } } |
| 141 |
f64 = maxnumf64(35f64, 36f64); |
| 142 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_fmax.? \(.*3\.5e\+1, .*3\.6e\+1\);$} 1 original } } |
| 143 |
|
| 144 |
f32 = copysignf32(37f32, 38f32); |
| 145 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_copysign. \(.*3\.7e\+1, .*3\.8e\+1\);$} 1 original } } |
| 146 |
f64 = copysignf64(39f64, 40f64); |
| 147 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_copysign.? \(.*3\.9e\+1, .*4\.0e\+1\);$} 1 original } } |
| 148 |
|
| 149 |
f32 = floorf32(41f32); |
| 150 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_floor. \(.*4\.1e\+1\);$} 1 original } } |
| 151 |
f64 = floorf64(42f64); |
| 152 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_floor.? \(.*4\.2e\+1\);$} 1 original } } |
| 153 |
|
| 154 |
f32 = ceilf32(43f32); |
| 155 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_ceil. \(.*4\.3e\+1\);$} 1 original } } |
| 156 |
f64 = ceilf64(44f64); |
| 157 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_ceil.? \(.*4\.4e\+1\);$} 1 original } } |
| 158 |
|
| 159 |
f32 = truncf32(45f32); |
| 160 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_trunc. \(.*4\.5e\+1\);$} 1 original } } |
| 161 |
f64 = truncf64(46f64); |
| 162 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_trunc.? \(.*4\.6e\+1\);$} 1 original } } |
| 163 |
|
| 164 |
f32 = rintf32(47f32); |
| 165 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_rint. \(.*4\.7e\+1\);$} 1 original } } |
| 166 |
f64 = rintf64(48f64); |
| 167 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_rint.? \(.*4\.8e\+1\);$} 1 original } } |
| 168 |
|
| 169 |
f32 = nearbyintf32(49f32); |
| 170 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_nearbyint. \(.*4\.9e\+1\);$} 1 original } } |
| 171 |
f64 = nearbyintf64(50f64); |
| 172 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_nearbyint.? \(.*5\.0e\+1\);$} 1 original } } |
| 173 |
|
| 174 |
f32 = roundf32(51f32); |
| 175 |
// { dg-final { scan-tree-dump-times {(?n)f32 .* __builtin_round. \(.*5\.1e\+1\);$} 1 original } } |
| 176 |
f64 = roundf64(52f64); |
| 177 |
// { dg-final { scan-tree-dump-times {(?n)f64 .* __builtin_round.? \(.*5\.2e\+1\);$} 1 original } } |
| 178 |
} |
| 179 |
|
| 180 |
unsafe { foo() }; |
| 181 |
} |