Bug 23154 - invalid register expression
Summary: invalid register expression
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.30
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-09 18:38 UTC by Baoshan
Modified: 2018-05-10 07:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Baoshan 2018-05-09 18:38:25 UTC
For assembly code:
$ cat x.s
        addis   %r5,%r1,2
        addis   %r5,%r0,2
        addis   5,0,2

A warning will be emited for line 2 but not for line 1 and line 3:
$ as -a32 -mppc -many -mbig -o x.o x.s
x.s: Assembler messages:
x.s:2: Warning: invalid register expression
Comment 1 Andreas Schwab 2018-05-09 21:28:19 UTC
For the second line, the second operand is not a register but the constant 0 (equivalent to lis %r5,2).
Comment 2 Baoshan 2018-05-09 21:33:09 UTC
(In reply to Andreas Schwab from comment #1)
> For the second line, the second operand is not a register but the constant 0
> (equivalent to lis %r5,2).

Do you mean even it is written as %r0 it is treated as constant 0? 
if so in line 3, the second operand is written explicity as constant 0, why it is OK?
Comment 3 Baoshan 2018-05-09 22:52:35 UTC
(In reply to Andreas Schwab from comment #1)
> For the second line, the second operand is not a register but the constant 0
> (equivalent to lis %r5,2).


Do you mean even it is written as %r0 it is treated as constant 0? 
if so in line 3, the second operand is written explicity as constant 0, why it is OK?
Comment 4 Andreas Schwab 2018-05-09 23:02:53 UTC
That's the point of the warning, an operand written as register but isn't one.
Comment 5 Baoshan 2018-05-09 23:13:59 UTC
(In reply to Andreas Schwab from comment #4)
> That's the point of the warning, an operand written as register but isn't
> one.

Is there any place/document I can check that's saying %r0 can not be used in this way?
Comment 6 Andreas Schwab 2018-05-10 07:31:04 UTC
Search for PowerPC ISA.