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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [gas/] [testsuite/] [gas/] [cris/] [bwtest-err-1.s] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
; File bwtest-err-1.s
2
 
3
;  { dg-do assemble { target cris-*-* } }
4
 
5
; A variant of exbwtest.s.  This is an example of invalid use of the broken-
6
; dot-word function.  The nearest label occurs about 32 kbytes after the primary
7
; jump table so the secondary jump table can't be reached by word displace-
8
; ments and the broken words overflow.
9
 
10
;  main()
11
;  {
12
;    byte i;
13
;
14
;    for (i=0; i <= 3; i++) {
15
;      result[i] = funct(i);
16
;    }
17
;  }
18
;
19
;  Register use :  r1 - i
20
;                  r2 - result address
21
 
22
        .text
23
        .syntax no_register_prefix
24
        .word   0
25
main:   move.d  stack,sp
26
        moveq   0,r1
27
        move.d  result,r2
28
for1:   cmpq    3,r1
29
        bgt     endfor1
30
        move.d  r1,r0
31
        jsr     funct
32
        move.w  r0,[r2+r1.w]
33
        ba      for1
34
        addq    1,r1
35
endfor1:
36
end:    ba      end
37
        nop
38
 
39
 
40
;  uword funct(i)
41
;    byte i;
42
;  {
43
;    switch (i) {
44
;      case 0 :  return 0x1111;
45
;      case 1 :  return 0x2222;
46
;      case 2 :  return 0x3333;
47
;      case 3 :  return 0x4444;
48
;    }
49
;  }
50
;
51
;  Parameters   :  r0 - i
52
;
53
;  Register use :  r1 - pjt address
54
 
55
funct:  push    r1
56
        move.d  pjt,r1
57
        adds.w  [r1+r0.w],pc
58
pjt:    .word   near1 - pjt
59
        .word   near2 - pjt
60
        .word   far1 - pjt
61
        .word   far2 - pjt
62
 
63
; Note that the line-number of the source-location of the error
64
; seems slightly off from the user perspective, but it's the
65
; best I could get without major changes in BW-handling.  Not
66
; sure it it's worth fixing.  May need adjustments if
67
; BW-handling changes.  Four errors from four .words are what's
68
; expected.
69
 
70
        .space  32760,0xFF; { dg-error "Adjusted signed \.word \(.*\) overflow.*" }
71
 
72
near1:  move.w  0x1111,r0
73
        ba      ret1
74
        nop
75
 
76
near2:  move.w  0x2222,r0
77
        ba      ret1
78
        nop
79
 
80
far1:   move.w  0x3333,r0
81
        ba      ret1
82
        nop
83
 
84
far2:   move.w  0x4444,r0
85
ret1:   pop     r1
86
        ret
87
 
88
 
89
result: .space  4 * 2   ; static uword result[4];
90
 
91
        .space  4
92
stack:

powered by: WebSVN 2.1.0

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