| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-march=rv32i -mabi=ilp32 -O" { target { rv32 } } } */ |
| 3 |
/* { dg-options "-march=rv64i -mabi=lp64 -O" { target { rv64 } } } */ |
| 4 |
|
| 5 |
|
| 6 |
/* 1) float -> BF16 |
| 7 |
* hf/sf/df/tf -> bf (call __trunc[h|s|d|t]fbf2) |
| 8 |
*/ |
| 9 |
|
| 10 |
/* 2) BF16 -> float |
| 11 |
* bf -> hf == sf -> hf (call __truncsfhf2) |
| 12 |
* bf -> sf (call __extendbfsf2) |
| 13 |
* bf -> df == bf -> sf -> df (call __extendbfsf2 && __extendsfdf2) |
| 14 |
* bf -> tf == bf -> sf -> tf (call __extendbfsf2 && __extendsftf2) |
| 15 |
*/ |
| 16 |
|
| 17 |
extern __bf16 bf; |
| 18 |
extern _Float16 hf; |
| 19 |
extern float sf; |
| 20 |
extern double df; |
| 21 |
extern long double tf; |
| 22 |
|
| 23 |
void hf_to_bf () { bf = hf; } |
| 24 |
void bf_to_hf () { hf = bf; } |
| 25 |
|
| 26 |
void sf_to_bf () { bf = sf; } |
| 27 |
void bf_to_sf () { sf = bf; } |
| 28 |
|
| 29 |
void df_to_bf () { bf = df; } |
| 30 |
void bf_to_df () { df = bf; } |
| 31 |
|
| 32 |
void tf_to_bf () { bf = tf; } |
| 33 |
void bf_to_tf () { tf = bf; } |
| 34 |
|
| 35 |
/* { dg-final { scan-assembler-times "call\t__extendbfsf2" 3 { target { rv32 } } } } */ |
| 36 |
/* { dg-final { scan-assembler-times "call\t__extendbfsf2" 3 { target { rv64 } } } } */ |
| 37 |
|
| 38 |
/* { dg-final { scan-assembler-times "call\t__extendsfdf2" 1 { target { rv32 } } } } */ |
| 39 |
/* { dg-final { scan-assembler-times "call\t__extendsfdf2" 1 { target { rv64 } } } } */ |
| 40 |
|
| 41 |
/* { dg-final { scan-assembler-times "call\t__extendsftf2" 1 { target { rv32 } } } } */ |
| 42 |
/* { dg-final { scan-assembler-times "call\t__extendsftf2" 1 { target { rv64 } } } } */ |
| 43 |
|
| 44 |
/* { dg-final { scan-assembler-times "call\t__truncsfhf2" 1 { target { rv32 } } } } */ |
| 45 |
/* { dg-final { scan-assembler-times "call\t__truncsfhf2" 1 { target { rv64 } } } } */ |
| 46 |
|
| 47 |
/* { dg-final { scan-assembler-times "call\t__trunchfbf2" 1 { target { rv32 } } } } */ |
| 48 |
/* { dg-final { scan-assembler-times "call\t__trunchfbf2" 1 { target { rv64 } } } } */ |
| 49 |
|
| 50 |
/* { dg-final { scan-assembler-times "call\t__truncsfbf2" 1 { target { rv32 } } } } */ |
| 51 |
/* { dg-final { scan-assembler-times "call\t__truncsfbf2" 1 { target { rv64 } } } } */ |
| 52 |
|
| 53 |
/* { dg-final { scan-assembler-times "call\t__truncdfbf2" 1 { target { rv32 } } } } */ |
| 54 |
/* { dg-final { scan-assembler-times "call\t__truncdfbf2" 1 { target { rv64 } } } } */ |
| 55 |
|
| 56 |
/* { dg-final { scan-assembler-times "call\t__trunctfbf2" 1 { target { rv32 } } } } */ |
| 57 |
/* { dg-final { scan-assembler-times "call\t__trunctfbf2" 1 { target { rv64 } } } } */ |