[compiler-rt] c1d6dca - [compiler-rt][AVR] Use correct return value for __ledf2 etc

Ayke van Laethem via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 13:52:36 PDT 2022


Author: Ayke van Laethem
Date: 2022-05-04T22:51:39+02:00
New Revision: c1d6dca694d001efe3d332db539348a9829d3869

URL: https://github.com/llvm/llvm-project/commit/c1d6dca694d001efe3d332db539348a9829d3869
DIFF: https://github.com/llvm/llvm-project/commit/c1d6dca694d001efe3d332db539348a9829d3869.diff

LOG: [compiler-rt][AVR] Use correct return value for __ledf2 etc

Previously the default was long, which is 32-bit on AVR. But avr-gcc
expects a smaller value: it reads the return value from r24.

This is actually a regression from https://reviews.llvm.org/D98205.
Before D98205, the return value was an enum (which was 2 bytes in size)
which was compatible with the 1-byte return value that avr-gcc was
expecting. But long is 4 bytes and thus places the significant return
value in a different register.

Differential Revision: https://reviews.llvm.org/D124939

Added: 
    

Modified: 
    compiler-rt/lib/builtins/fp_compare_impl.inc

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/fp_compare_impl.inc b/compiler-rt/lib/builtins/fp_compare_impl.inc
index 40fc7df4c679c..a9a4f6fbf5dfe 100644
--- a/compiler-rt/lib/builtins/fp_compare_impl.inc
+++ b/compiler-rt/lib/builtins/fp_compare_impl.inc
@@ -18,6 +18,9 @@ typedef int CMP_RESULT;
 #elif __SIZEOF_POINTER__ == 8 && __SIZEOF_LONG__ == 4
 // LLP64 ABIs use long long instead of long.
 typedef long long CMP_RESULT;
+#elif __AVR__
+// AVR uses a single byte for the return value.
+typedef char CMP_RESULT;
 #else
 // Otherwise the comparison functions return long.
 typedef long CMP_RESULT;


        


More information about the llvm-commits mailing list