Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AVR] Add support for the -mdouble=x flag
This flag is used by avr-gcc (starting with v10) to set the width of the double type. The double type is by default interpreted as a 32-bit floating point number in avr-gcc instead of a 64-bit floating point number as is common on other architectures. Starting with GCC 10, a new option has been added to control this behavior: https://gcc.gnu.org/wiki/avr-gcc#Deviations_from_the_Standard This commit keeps the default double at 32 bits but adds support for the -mdouble flag (-mdouble=32 and -mdouble=64) to control this behavior. Differential Revision: https://reviews.llvm.org/D76181
- Loading branch information
Showing
7 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=avr-unknown-unknown -mdouble=64 | \ | ||
// RUN: FileCheck --check-prefix=AVR-FP64 %s | ||
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=avr-unknown-unknown -mdouble=32 | \ | ||
// RUN: FileCheck --check-prefix=AVR-FP32 %s | ||
|
||
double x = 0; | ||
int size = sizeof(x); | ||
|
||
// FIXME: the double should have an alignment of 1 on AVR, not 4 or 8. | ||
// AVR-FP64: @x = global double {{.*}}, align 8 | ||
// AVR-FP64: @size = global i16 8 | ||
// AVR-FP32: @x = global float {{.*}}, align 4 | ||
// AVR-FP32: @size = global i16 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// RUN: %clang -target avr -c -### %s -mdouble=64 2>&1 | FileCheck %s | ||
|
||
// CHECK: "-mdouble=64" | ||
|
||
// RUN: %clang -target aarch64 -c -### %s -mdouble=64 2>&1 | FileCheck --check-prefix=ERR %s | ||
|
||
// ERR: error: unsupported option '-mdouble=64' for target 'aarch64' |