@@ -20,29 +20,47 @@ struct fp80x2_s {
20
20
}
21
21
};
22
22
23
- constexpr static fp80x2_v test_vec_fp80 = { 1 , 2 };
24
- constexpr static fp80x2_s test_str_fp80 = { { 0 , 0 , 0 , 0 , 0 , 0 , 0 , -128 , -1 , 63 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -128 , 0 , 64 }, {} };
23
+ namespace builtin_bit_cast {
24
+ constexpr static fp80x2_v test_vec_fp80 = { 1 , 2 };
25
+ constexpr static fp80x2_s test_str_fp80 = { { 0 , 0 , 0 , 0 , 0 , 0 , 0 , -128 , -1 , 63 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -128 , 0 , 64 }, {} };
25
26
26
- // expected-error@+2 {{static assertion expression is not an integral constant expression}}
27
- // expected-note@+1 {{constexpr bit_cast involving type 'long double' is not yet supported}}
28
- static_assert (__builtin_bit_cast(fp80x2_s, test_vec_fp80) == test_str_fp80, "");
27
+ // expected-error@+2 {{static assertion expression is not an integral constant expression}}
28
+ // expected-note@+1 {{constexpr bit cast involving type 'long double' is not yet supported}}
29
+ static_assert (__builtin_bit_cast(fp80x2_s, test_vec_fp80) == test_str_fp80, " " );
29
30
30
- // expected-error@+2 {{static assertion expression is not an integral constant expression}}
31
- // expected-note@+1 {{constexpr bit_cast involving type 'long double' is not yet supported}}
32
- static_assert (__builtin_bit_cast(fp80x2_s, __builtin_bit_cast(fp80x2_v, test_str_fp80)) == test_str_fp80, "");
31
+ // expected-error@+2 {{static assertion expression is not an integral constant expression}}
32
+ // expected-note@+1 {{constexpr bit cast involving type 'long double' is not yet supported}}
33
+ static_assert (__builtin_bit_cast(fp80x2_s, __builtin_bit_cast(fp80x2_v, test_str_fp80)) == test_str_fp80, " " );
33
34
34
- // expected-error@+2 {{constexpr variable 'bad_str_fp80_0' must be initialized by a constant expression}}
35
- // expected-note@+1 {{constexpr bit_cast involving type 'long double' is not yet supported}}
36
- constexpr static char bad_str_fp80_0 = __builtin_bit_cast(fp80x2_s, test_vec_fp80)._pad[0 ];
35
+ // expected-error@+2 {{constexpr variable 'bad_str_fp80_0' must be initialized by a constant expression}}
36
+ // expected-note@+1 {{constexpr bit cast involving type 'long double' is not yet supported}}
37
+ constexpr static char bad_str_fp80_0 = __builtin_bit_cast(fp80x2_s, test_vec_fp80)._pad[0 ];
37
38
38
- // expected-error@+2 {{constexpr variable 'bad_str_fp80_1' must be initialized by a constant expression}}
39
- // expected-note@+1 {{constexpr bit_cast involving type 'long double' is not yet supported}}
40
- constexpr static char bad_str_fp80_1 = __builtin_bit_cast(fp80x2_s, test_vec_fp80)._pad[1 ];
39
+ // expected-error@+2 {{constexpr variable 'bad_str_fp80_1' must be initialized by a constant expression}}
40
+ // expected-note@+1 {{constexpr bit cast involving type 'long double' is not yet supported}}
41
+ constexpr static char bad_str_fp80_1 = __builtin_bit_cast(fp80x2_s, test_vec_fp80)._pad[1 ];
41
42
42
- // expected-error@+2 {{constexpr variable 'bad_str_fp80_11' must be initialized by a constant expression}}
43
- // expected-note@+1 {{constexpr bit_cast involving type 'long double' is not yet supported}}
44
- constexpr static char bad_str_fp80_11 = __builtin_bit_cast(fp80x2_s, test_vec_fp80)._pad[11 ];
43
+ // expected-error@+2 {{constexpr variable 'bad_str_fp80_11' must be initialized by a constant expression}}
44
+ // expected-note@+1 {{constexpr bit cast involving type 'long double' is not yet supported}}
45
+ constexpr static char bad_str_fp80_11 = __builtin_bit_cast(fp80x2_s, test_vec_fp80)._pad[11 ];
45
46
46
- // expected-error@+2 {{constexpr variable 'struct2v' must be initialized by a constant expression}}
47
- // expected-note@+1 {{constexpr bit_cast involving type 'long double' is not yet supported}}
48
- constexpr static fp80x2_v struct2v = __builtin_bit_cast(fp80x2_v, test_str_fp80);
47
+ // expected-error@+2 {{constexpr variable 'struct2v' must be initialized by a constant expression}}
48
+ // expected-note@+1 {{constexpr bit cast involving type 'long double' is not yet supported}}
49
+ constexpr static fp80x2_v struct2v = __builtin_bit_cast(fp80x2_v, test_str_fp80);
50
+ }
51
+
52
+ namespace c_cast {
53
+ typedef short v12i16 __attribute ((vector_size(24 )));
54
+ typedef long double v2f80 __attribute ((vector_size(24 )));
55
+
56
+ // FIXME: re-enable the corresponding test cases in CodeGen/const-init.c when
57
+ // constexpr bitcast with x86_fp80 is supported
58
+
59
+ // expected-error@+2 {{constexpr variable 'b' must be initialized by a constant expression}}
60
+ // expected-note@+1 {{constexpr bit cast involving type 'long double' is not yet supported}}
61
+ constexpr static v12i16 b = (v12i16)(v2f80){1 ,2 };
62
+
63
+ // expected-error@+2 {{constexpr variable 'c' must be initialized by a constant expression}}
64
+ // expected-note@+1 {{constexpr bit cast involving type 'long double' is not yet supported}}
65
+ constexpr static v2f80 c = (v2f80)(v12i16){0 ,0 ,0 ,-32768 ,16383 ,0 ,0 ,0 ,0 ,-32768 ,16384 ,0 };
66
+ }
0 commit comments