aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2024-05-08 17:52:56 +0200
committerGeorg-Johann Lay <avr@gjlay.de>2024-05-10 11:36:25 +0200
commitaf64af69c3cc85dbe00c520651a54850bf5cadc1 (patch)
treeda391e390206c068f1457ebac5c324f1d7594f7b /gcc
parentbb5f619a938567b316306bdc46f0efb8d18ddc59 (diff)
downloadgcc-af64af69c3cc85dbe00c520651a54850bf5cadc1.zip
gcc-af64af69c3cc85dbe00c520651a54850bf5cadc1.tar.gz
gcc-af64af69c3cc85dbe00c520651a54850bf5cadc1.tar.bz2
AVR: target/114981 - Tweak __builtin_powif / __powisf2
Implement __powisf2 in assembly. PR target/114981 libgcc/ * config/avr/t-avr (LIB2FUNCS_EXCLUDE): Add _powisf2. (LIB1ASMFUNCS) [!avrtiny]: Add _powif. * config/avr/lib1funcs.S (mov4): New .macro. (L_powif, __powisf2) [!avrtiny]: New module and function. gcc/testsuite/ * gcc.target/avr/pr114981-powif.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.target/avr/pr114981-powif.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/avr/pr114981-powif.c b/gcc/testsuite/gcc.target/avr/pr114981-powif.c
new file mode 100644
index 0000000..191dcc6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/pr114981-powif.c
@@ -0,0 +1,33 @@
+/* { dg-do run { target { ! avr_tiny } } } */
+/* { dg-additional-options "-Os" } */
+
+const float vals[] =
+ {
+ 0.0625f, -0.125f, 0.25f, -0.5f,
+ 1.0f,
+ -2.0f, 4.0f, -8.0f, 16.0f
+ };
+
+#define ARRAY_SIZE(X) ((int) (sizeof(X) / sizeof(*X)))
+
+__attribute__((noinline,noclone))
+void test1 (float x)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE (vals); ++i)
+ {
+ float val0 = vals[i];
+ float val1 = __builtin_powif (x, i - 4);
+ __asm ("" : "+r" (val0));
+
+ if (val0 != val1)
+ __builtin_exit (__LINE__);
+ }
+}
+
+int main (void)
+{
+ test1 (-2.0f);
+ return 0;
+}