This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/87888] New: Behaviour of __builtin_arc_sr differs from its description in the manual.
- From: "nbowler at draconx dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 05 Nov 2018 20:47:11 +0000
- Subject: [Bug c/87888] New: Behaviour of __builtin_arc_sr differs from its description in the manual.
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87888
Bug ID: 87888
Summary: Behaviour of __builtin_arc_sr differs from its
description in the manual.
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: nbowler at draconx dot ca
Target Milestone: ---
I happened to notice what appears to be an error in the GCC manual,
§6.59.4 ARC Built-in Functions[1]:
Built-in Function: void __builtin_arc_sr (unsigned int auxr, unsigned int val)
The first argument, /auxv/, is the address of an auxiliary register,
the second argument, /val/, is a compile time constant to be written
to the register. Generates:
sr auxr, [val]
This function indeed generates the sr instruction with the parameters
exactly as described, e.g., __builtin_arc_sr(0x123, 0x456) generates
sr 0x123, [0x456]
However, the description of those parameters is incorrect: the first
operand of sr is the value to be written, and the second is the address,
so the previous example stores the value 0x123 to aux address 0x456.
Also I think the note about val being a compile-time constant is an
error as well... the sr instruction does not require constants, and
gcc happily accepts non-constant values as arguments to this builtin.
I suggest the documentation of this builtin should be changed to match
its actual behaviour, perhaps something like:
Built-in Function: void __builtin_arc_sr (unsigned int val, unsigned int auxr)
Stores /val/ to the auxiliary register with address /auxr/. Generates:
sr val, [auxr]
[1]
https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/ARC-Built-in-Functions.html#index-_005f_005fbuiltin_005farc_005fsr