Ayke van Laethem a8efcb96e6
[AVR][Clang] Implement __AVR_HAVE_*__ macros
These macros are defined in avr-gcc and are useful when working with
assembly. For example, startup code needs to copy the contents of .data
from flash to RAM, but should use elpm (instead of lpm) on devices with
more than 64kB flash. Without __AVR_HAVE_ELPM__, there is no way to know
whether the elpm instruction is supported.

This partially fixes https://github.com/llvm/llvm-project/issues/56157.

Differential Revision: https://reviews.llvm.org/D137572
2022-11-23 01:21:09 +01:00

13 lines
460 B
C

// RUN: %clang_cc1 -E -dM -triple avr-unknown-unknown -target-cpu atmega328p /dev/null | FileCheck -match-full-lines %s
// CHECK: #define AVR 1
// CHECK: #define __AVR 1
// CHECK: #define __AVR_ARCH__ 5
// CHECK: #define __AVR_ATmega328P__ 1
// CHECK-NOT: #define __AVR_HAVE_EIJMP_EICALL__
// CHECK: #define __AVR_HAVE_LPMX__ 1
// CHECK: #define __AVR_HAVE_MOVW__ 1
// CHECK: #define __AVR_HAVE_MUL__ 1
// CHECK: #define __AVR__ 1
// CHECK: #define __ELF__ 1