public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Michael Meissner <meissner@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/meissner/heads/work029)] PowerPC: Add long double target-supports.
Date: Thu,  3 Dec 2020 21:27:55 +0000 (GMT)	[thread overview]
Message-ID: <20201203212755.1BF4C397183D@sourceware.org> (raw)

https://gcc.gnu.org/g:cc49b698925058b3bf0dee0ef7cbc1ff69fd6af7

commit cc49b698925058b3bf0dee0ef7cbc1ff69fd6af7
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Thu Dec 3 16:27:23 2020 -0500

    PowerPC: Add long double target-supports.
    
    This patch adds 3 target supports to test what type of PowerPC long double is
    used by the test:
    
       1)   Long double uses the IBM 128-bit extended double format;
       2)   Long double uses the IEEE 128-bit format; (and)
       3)   Long double uses the 64-bit format.
    
    gcc/testsuite/
    2020-12-03  Michael Meissner  <meissner@linux.ibm.com>
    
            * lib/target-supports.exp
            (check_effective_target_ppc_long_double_ibm): New function.
            (check_effective_target_ppc_long_double_ieee): New function.
            (check_effective_target_ppc_long_double_64bit): New function.

Diff:
---
 gcc/testsuite/lib/target-supports.exp | 133 ++++++++++++++++++++++++++++++++++
 1 file changed, 133 insertions(+)

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ff6bc5f4b92..2909d7ea8b9 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2348,6 +2348,59 @@ proc check_effective_target_ppc_ieee128_ok { } {
     }]
 }
 
+# See if the target is a powerpc with the long double format that uses the IBM
+# extended double format.
+
+proc check_effective_target_ppc_long_double_ibm { } {
+    return [check_cached_effective_target ppc_long_double_ibm {
+	check_runtime_nocache ppc_long_double_ibm {
+	    int main()
+	    {
+	      #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IBM128__)
+		return 1;
+	      #else
+		return 0;
+	      #endif
+	    }
+	}
+    }]
+}
+
+# See if the target is a powerpc with the long double format that uses the IEEE
+# 128-bit format.
+
+proc check_effective_target_ppc_long_double_ieee { } {
+    return [check_cached_effective_target ppc_long_double_ieee {
+	check_runtime_nocache ppc_long_double_ieee {
+	    int main()
+	    {
+	      #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IEEE128__)
+		return 1;
+	      #else
+		return 0;
+	      #endif
+	    }
+	}
+    }]
+}
+
+# See if the target is a powerpc with the long double format that is 64-bit.
+
+proc check_effective_target_ppc_long_double_64bit { } {
+    return [check_cached_effective_target ppc_long_double_64bit {
+	check_runtime_nocache ppc_long_double_64bit {
+	    int main()
+	    {
+	      #ifndef _ARCH_PPC
+		return 1;
+	      #else
+		return sizeof (long double) != 64;
+	      #endif
+	    }
+	}
+    }]
+}
+
 # Return 1 if the target supports executing VSX instructions, 0
 # otherwise.  Cache the result.
 
@@ -10662,3 +10715,83 @@ proc check_effective_target_no_fsanitize_address {} {
     }
     return 0;
 }
+
+# Return 1 if this target supports 'R' flag in .section directive, 0
+# otherwise.  Cache the result.
+
+proc check_effective_target_R_flag_in_section { } {
+    global tool
+    global GCC_UNDER_TEST
+
+    # Need auto-host.h to check linker support.
+    if { ![file exists ../../auto-host.h ] } {
+	return 0
+    }
+
+    return [check_cached_effective_target R_flag_in_section {
+
+	set src pie[pid].c
+	set obj pie[pid].o
+
+	set f [open $src "w"]
+	puts $f "#include \"../../auto-host.h\""
+	puts $f "#if HAVE_GAS_SHF_GNU_RETAIN == 0"
+	puts $f "# error Assembler does not support 'R' flag in .section directive."
+	puts $f "#endif"
+	close $f
+
+	verbose "check_effective_target_R_flag_in_section compiling testfile $src" 2
+	set lines [${tool}_target_compile $src $obj assembly ""]
+
+	file delete $src
+	file delete $obj
+
+	if [string match "" $lines] then {
+	    verbose "check_effective_target_R_flag_in_section testfile compilation passed" 2
+	    return 1
+	} else {
+	    verbose "check_effective_target_R_flag_in_section testfile compilation failed" 2
+	    return 0
+	}
+    }]
+}
+
+# Return 1 if this target supports 'o' flag in .section directive, 0
+# otherwise.  Cache the result.
+
+proc check_effective_target_o_flag_in_section { } {
+    global tool
+    global GCC_UNDER_TEST
+
+    # Need auto-host.h to check linker support.
+    if { ![file exists ../../auto-host.h ] } {
+	return 0
+    }
+
+    return [check_cached_effective_target o_flag_in_section {
+
+	set src pie[pid].c
+	set obj pie[pid].o
+
+	set f [open $src "w"]
+	puts $f "#include \"../../auto-host.h\""
+	puts $f "#if HAVE_GAS_SECTION_LINK_ORDER == 0"
+	puts $f "# error Assembler does not support 'o' flag in .section directive."
+	puts $f "#endif"
+	close $f
+
+	verbose "check_effective_target_o_flag_in_section compiling testfile $src" 2
+	set lines [${tool}_target_compile $src $obj object ""]
+
+	file delete $src
+	file delete $obj
+
+	if [string match "" $lines] then {
+	    verbose "check_effective_target_o_flag_in_section testfile compilation passed" 2
+	    return 1
+	} else {
+	    verbose "check_effective_target_o_flag_in_section testfile compilation failed" 2
+	    return 0
+	}
+    }]
+}


             reply	other threads:[~2020-12-03 21:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 21:27 Michael Meissner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-12-04  1:18 Michael Meissner
2020-12-03 21:38 Michael Meissner
2020-11-30 18:29 Michael Meissner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201203212755.1BF4C397183D@sourceware.org \
    --to=meissner@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).