[PATCH] D65863: [ARM] Add support for the s,j,x,N,O inline asm constraints

David Candler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 05:13:37 PDT 2019


dcandler created this revision.
dcandler added reviewers: rsmith, t.p.northover, compnerd, void, joerg, efriedma, ostannard.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya, kristof.beyls, javed.absar.
Herald added projects: clang, LLVM.

A number of inline assembly constraints are currently supported by LLVM, but rejected as invalid by Clang:

Target independent constraints:

s: An integer constant, but allowing only relocatable values

ARM specific constraints:

j: An immediate integer between 0 and 65535 (valid for MOVW)
x: A 32, 64, or 128-bit floating-point/SIMD register: s0-s15, d0-d7, or q0-q3
N: An immediate integer between 0 and 31 (Thumb1 only)
O: An immediate integer which is a multiple of 4 between -508 and 508. (Thumb1 only)

This patch adds support to Clang for the missing constraints along with some checks to ensure that the constraints are used with the correct target and Thumb mode, and that immediates are within valid ranges (at least where possible). The constraints are already implemented in LLVM, but just a couple of minor corrections to checks (V8M Baseline includes MOVW so should work with 'j', 'N' and 'O' shouldn't be valid in Thumb2) so that Clang and LLVM are in line with each other and the documentation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65863

Files:
  clang/lib/Basic/Targets/ARM.cpp
  clang/test/Sema/arm_inline_asm_constraints.c
  llvm/lib/Target/ARM/ARMISelLowering.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65863.213852.patch
Type: text/x-patch
Size: 13814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190807/5c64b42e/attachment.bin>


More information about the llvm-commits mailing list