diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/bitfield-integer-promotion-long.c | 6 | ||||
-rw-r--r-- | test/bitfield-integer-promotion-long.qbe | 6 | ||||
-rw-r--r-- | test/bitfield-integer-promotion.c | 7 | ||||
-rw-r--r-- | test/bitfield-integer-promotion.qbe | 17 |
4 files changed, 36 insertions, 0 deletions
diff --git a/test/bitfield-integer-promotion-long.c b/test/bitfield-integer-promotion-long.c new file mode 100644 index 0000000..fc51fbc --- /dev/null +++ b/test/bitfield-integer-promotion-long.c @@ -0,0 +1,6 @@ +struct {unsigned long x:31;} s1; +struct {unsigned long x:32;} s2; +struct {unsigned long x:33;} s3; +int c1 = __builtin_types_compatible_p(__typeof__(+s1.x), int); +int c2 = __builtin_types_compatible_p(__typeof__(+s2.x), unsigned); +int c3 = __builtin_types_compatible_p(__typeof__(+s3.x), unsigned long); diff --git a/test/bitfield-integer-promotion-long.qbe b/test/bitfield-integer-promotion-long.qbe new file mode 100644 index 0000000..761cbee --- /dev/null +++ b/test/bitfield-integer-promotion-long.qbe @@ -0,0 +1,6 @@ +export data $c1 = align 4 { w 1, } +export data $c2 = align 4 { w 1, } +export data $c3 = align 4 { w 1, } +export data $s1 = align 8 { z 8 } +export data $s2 = align 8 { z 8 } +export data $s3 = align 8 { z 8 } diff --git a/test/bitfield-integer-promotion.c b/test/bitfield-integer-promotion.c new file mode 100644 index 0000000..e0a95f5 --- /dev/null +++ b/test/bitfield-integer-promotion.c @@ -0,0 +1,7 @@ +struct { + unsigned a : 2; +} s; + +int main(void) { + return -1 > s.a; +} diff --git a/test/bitfield-integer-promotion.qbe b/test/bitfield-integer-promotion.qbe new file mode 100644 index 0000000..dd3bf63 --- /dev/null +++ b/test/bitfield-integer-promotion.qbe @@ -0,0 +1,17 @@ +export +function w $main() { +@start.1 +@body.2 + %.1 =w sub 0, 1 + %.2 =l copy $s + %.3 =l mul 0, 1 + %.4 =l add %.2, %.3 + %.5 =l copy %.4 + %.6 =w loaduw %.5 + %.7 =w shl %.6, 30 + %.8 =w shr %.7, 30 + %.9 =w copy %.8 + %.10 =w csgtw %.1, %.9 + ret %.10 +} +export data $s = align 4 { z 4 } |