LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 12926 - Inline ARMv7 assembler
Summary: Inline ARMv7 assembler
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: trunk
Hardware: Macintosh MacOS X
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks: 18926
  Show dependency tree
 
Reported: 2012-05-23 12:05 PDT by Frank Kuehnel
Modified: 2015-12-09 11:01 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Kuehnel 2012-05-23 12:05:05 PDT
The armv7 architecture should be able to deal with the armv6t2 instruction set for moving 16 bit values.

// current clang inline assembler bug for: /usr/local/bin/clang -march=armv7 -ccc-host-triple arm-apple-darwin11 -c test.c
#ifdef __arm__
int test(void) {
    int val;
    asm (
      //"mov %[r0], #0xff \n\t"              // old ARM way for 1023 constant (works)
      //"orr %[r0], %[r0], #0x300 \n\t"
      "movw %[r0], #1023 \n\t"             // new ARMv6T2 way for 16 bit wide constants
      "movt %[r0], #0 \n\t"
      :  [r0] "=r" (val)
  );
  return val;
}
#endif

Currently this results in an error:
test.c:8:7: error: instruction requires: armv6t2
      "movw %[r0], #1023 \n\t"             // new ARMv6T2 way for 16 bit wide constants
      ^
<inline asm>:1:2: note: instantiated into assembly here
        movw r0, #1023
Comment 1 Renato Golin 2015-12-09 11:01:27 PST
Both modes working now.