Skip to content

Conversation

winstonallo
Copy link

@winstonallo winstonallo commented Oct 13, 2025

Closes rust-lang/rustc_codegen_gcc#771

Hey, after a quick search, I only found two target-specific files that were using the jit_target_add_supported_target_dependent_type function:

Changes:

  • Created a jit_target_dependent_types_init function in gcc/jit/jit-target.cc, which is called in jit_target_init
  • Removed the now redundant code from gcc/config/i386/i386-jit.cc and gcc/config/aarch64/aarch64-jit.cc
  • Updated the patch patches/0001-Disable-128-bit-integers-for-testing-purposes.patch to work with the new changes

EDIT: Update description to match changes

@winstonallo
Copy link
Author

If I'm not mistaken, the new patch should be

From 917bec7df60cdda81e21119fe629eb3b71a77db8 Mon Sep 17 00:00:00 2001
From: winstonallo <[email protected]>
Date: Mon, 13 Oct 2025 11:16:36 +0200
Subject: [PATCH] Disable 128-bit integers for testing purposes

---
 gcc/jit/jit-playback.cc | 8 ++++----
 gcc/jit/jit-target.cc   | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc
index 4da3156af74..e6c88e9c6f1 100644
--- a/gcc/jit/jit-playback.cc
+++ b/gcc/jit/jit-playback.cc
@@ -250,8 +250,8 @@ get_tree_node_for_type (enum gcc_jit_types type_)
     case GCC_JIT_TYPE_UINT64_T:
       return uint64_type_node;
     case GCC_JIT_TYPE_UINT128_T:
-      if (targetm.scalar_mode_supported_p (TImode))
-	return uint128_type_node;
+      /*if (targetm.scalar_mode_supported_p (TImode))
+      return uint128_type_node;*/
 
       add_error (NULL, "gcc_jit_types value unsupported on this target: %i",
 		 type_);
@@ -266,8 +266,8 @@ get_tree_node_for_type (enum gcc_jit_types type_)
     case GCC_JIT_TYPE_INT64_T:
       return intDI_type_node;
     case GCC_JIT_TYPE_INT128_T:
-      if (targetm.scalar_mode_supported_p (TImode))
-	return intTI_type_node;
+      /*if (targetm.scalar_mode_supported_p (TImode))
+      return intTI_type_node;*/
 
       add_error (NULL, "gcc_jit_types value unsupported on this target: %i",
 		 type_);
diff --git a/gcc/jit/jit-target.cc b/gcc/jit/jit-target.cc
index 4f0f7ebd980..f159f6190d6 100644
--- a/gcc/jit/jit-target.cc
+++ b/gcc/jit/jit-target.cc
@@ -44,11 +44,11 @@ jit_target_init ()
   targetjitm.jit_register_cpu_target_info ();
   targetjitm.jit_register_os_target_info ();
 
-  if (targetm.scalar_mode_supported_p (TImode))
+  /*if (targetm.scalar_mode_supported_p (TImode))
   {
     jit_target_add_supported_target_dependent_type(GCC_JIT_TYPE_UINT128_T);
     jit_target_add_supported_target_dependent_type(GCC_JIT_TYPE_INT128_T);
-  }
+  }*/
 
   if (float16_type_node != NULL && TYPE_PRECISION(float16_type_node) == 16)
     jit_target_add_supported_target_dependent_type(GCC_JIT_TYPE_FLOAT16);
-- 
2.43.0

@antoyo
Copy link

antoyo commented Oct 13, 2025

  • Am I missing something or were thoses changes only required for i386 and aarch64?

No, there were only two targets.

  • Since this does not add any functionality, should I create tests or is the lack of change in the test results with and without the changes enough?

No new tests needed.

  • The CI is failing due to a patch that cannot be applied anymore (patches/0001-Disable-128-bit-integers-for-testing-purposes.patch), how can I update this patch?

Usually, I redo the patch completely since it is easier to fix the conflict.

@antoyo
Copy link

antoyo commented Oct 13, 2025

Also, I frequently rebase the master branch of this repo to get the latest changes from upstream, so you'll probably need to reset the branch of this PR to remove the unrelated changes.
Sorry about that.

@antoyo
Copy link

antoyo commented Oct 13, 2025

If I'm not mistaken, the new patch should be

Yeah, that seems OK.

@winstonallo
Copy link
Author

Also, I frequently rebase the master branch of this repo to get the latest changes from upstream, so you'll probably need to reset the branch of this PR to remove the unrelated changes. Sorry about that.

No problem

@winstonallo winstonallo reopened this Oct 13, 2025
@winstonallo
Copy link
Author

I reset my branch and addressed your comments, let me know if there is anything else

@antoyo antoyo merged commit ffdf627 into rust-lang:master Oct 13, 2025
4 checks passed
@antoyo
Copy link

antoyo commented Oct 13, 2025

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove duplication of target dependent types detection

2 participants