Skip to main content

IAR Embedded Workbench for RISC-V 3.40

%pcrel_hi Upper 20 bits PC-relative

In this section:
Precedence

2

Description

%pcrel_hi uses PC-relative addressing and takes the upper 20 bits, compensated for a negative lower 12-bit field, right-shifted 12 positions. The intended use for this operator is for the instruction AUIPC and for instructions like ADDI, LW, and SW to construct a 32-bit address.

Example
  auipc   a0, %pcrel_hi(myVar)
relative_to:
  lw      a0, %pcrel_lo(relative_to)(a0)