OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [avr/] [pr46779-1.c] - Blame information for rev 764

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-Os -fsplit-wide-types" } */
3
 
4
/* This testcase should uncover bugs like
5
   PR46779
6
   PR45291
7
   PR41894
8
 
9
   The inline asm just serves to direct y into the Y register.
10
   Otherwise, it is hard to write a "stable" test case that
11
   also fails with slight variations in source code, middle- resp.
12
   backend.
13
 
14
   The problem is that Y is also the frame-pointer, and
15
   avr.c:avr_hard_regno_mode_ok disallows QI to get in Y-reg.
16
   However, the y.a = 0 generates a
17
       (set (subreg:QI (reg:HI pseudo)) ...)
18
   where pseudo gets allocated to Y.
19
 
20
   Reload fails to generate the right spill.
21
*/
22
 
23
#include <stdlib.h>
24
 
25
struct S
26
{
27
    unsigned char a, b;
28
} ab = {12, 34};
29
 
30
void yoo (struct S y)
31
{
32
    __asm volatile ("ldi %B0, 56" : "+y" (y));
33
    y.a = 0;
34
    __asm volatile ("; y = %0" : "+y" (y));
35
    ab = y;
36
}
37
 
38
int main ()
39
{
40
    yoo (ab);
41
 
42
    if (ab.a != 0)
43
        abort();
44
 
45
    if (ab.b != 56)
46
        abort();
47
 
48
    exit (0);
49
 
50
    return 0;
51
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.