From 8cc38abf575381905eb3a869b0874bdaddb608bb Mon Sep 17 00:00:00 2001
From: Haochen Jiang <haochen.jiang@intel.com>
Date: Fri, 1 Nov 2024 10:04:36 +0800
Subject: Support Intel AMX-TF32

gcc/ChangeLog:

	* common/config/i386/cpuinfo.h (get_available_features):
	Detect AMX-TF32.
	* common/config/i386/i386-common.cc (OPTION_MASK_ISA2_AMX_TF32_SET,
	OPTION_MASK_ISA2_AMX_TF32_UNSET): New.
	(ix86_handle_option): Handle -mamx-tf32.
	* common/config/i386/i386-cpuinfo.h (enum processor_features):
	Add FEATURE_AMX_TF32.
	* common/config/i386/i386-isas.h: Add ISA_NAME_TABLE_ENTRY for
	amx-tf32.
	* config.gcc: Add amxtf32intrin.h
	* config/i386/cpuid.h (bit_AMX_TF32): New.
	* config/i386/i386-c.cc (ix86_target_macros_internal): Handle amx-tf32.
	* config/i386/i386-isa.def (AMX_TF32): Add DEF_PTA(AMX_TF32).
	* config/i386/i386-options.cc (ix86_valid_target_attribute_inner_p):
	Handle amx-tf32.
	* config/i386/i386.opt: Add option -mamx-tf32.
	* config/i386/i386.opt.urls: Regenerated.
	* config/i386/immintrin.h: Include amxtf32intrin.h.
	* doc/extend.texi: Document amx-tf32.
	* doc/invoke.texi: Document -mamx-tf32.
	* doc/sourcebuild.texi: Document target amx-tf32.
	* config/i386/amxtf32intrin.h: New file.

gcc/testsuite/ChangeLog:

	* g++.dg/other/i386-2.C: Add -mamx-tf32.
	* g++.dg/other/i386-3.C: Ditto.
	* gcc.target/i386/amx-check.h: Add cpu check for AMX-TF32.
	* gcc.target/i386/funcspec-56.inc: Add new target attribute.
	* gcc.target/i386/sse-12.c: Add -mamx-tf32.
	* gcc.target/i386/sse-13.c: Ditto.
	* gcc.target/i386/sse-14.c: Ditto.
	* gcc.target/i386/sse-22.c: Add amx-tf32.
	* gcc.target/i386/sse-23.c: Ditto.
	* lib/target-supports.exp (check_effective_target_amx_tf32): New.
	* gcc.target/i386/amx-helper.h: New file for tf32 support.
	* gcc.target/i386/amxtf32-asmatt-1.c: New test.
	* gcc.target/i386/amxtf32-asmintel-1.c: Ditto.
	* gcc.target/i386/amxtf32-mmultf32ps-2.c: Ditto.
---
 gcc/config/i386/i386-isa.def | 1 +
 1 file changed, 1 insertion(+)

(limited to 'gcc/config/i386/i386-isa.def')

diff --git a/gcc/config/i386/i386-isa.def b/gcc/config/i386/i386-isa.def
index fcc3bc4..1b82a69 100644
--- a/gcc/config/i386/i386-isa.def
+++ b/gcc/config/i386/i386-isa.def
@@ -124,3 +124,4 @@ DEF_PTA(AVX10_1_512)
 DEF_PTA(AVX10_2_256)
 DEF_PTA(AVX10_2_512)
 DEF_PTA(AMX_AVX512)
+DEF_PTA(AMX_TF32)
-- 
cgit v1.1

