PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / combine-subregs.c
blobccace233cf87ca95be68f0e54885d1302df6ee47
1 /* { dg-do run { target { stdint_types } } } */
2 /* { dg-options "-O2" } */
4 #include <stdint.h>
5 #include <stdlib.h>
7 void __attribute__ ((noinline))
8 foo (uint64_t state, uint32_t last)
10 if (state == last) abort ();
13 /* This function may do a bad comparision by trying to
14 use SUBREGS during the compare on machines where comparing
15 two registers always compares the entire register regardless
16 of mode. */
18 int __attribute__ ((noinline))
19 compare (uint64_t state, uint32_t *last, uint8_t buf)
21 if (*last == ((state | buf) & 0xFFFFFFFF)) {
22 foo (state, *last);
23 return 0;
25 return 1;
28 int
29 main(int argc, char **argv) {
30 uint64_t state = 0xF00000100U;
31 uint32_t last = 0x101U;
32 int ret = compare(state, &last, 0x01);
33 if (ret != 0)
34 abort ();
35 exit (0);