jit: implement BT_CONST_VOLATILE_PTR [PR 95306]
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 3 Jun 2020 12:59:23 +0000 (08:59 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 3 Jun 2020 15:14:46 +0000 (11:14 -0400)
gcc/jit/ChangeLog:
PR jit/95306
* jit-builtins.c (builtins_manager::make_primitive_type):
Implement BT_CONST_VOLATILE_PTR.

gcc/testsuite/ChangeLog:
PR jit/95306
* jit.dg/test-pr95306-builtin-types.c (create_code): Add
test of getting __atomic_load.

gcc/jit/jit-builtins.c
gcc/testsuite/jit.dg/test-pr95306-builtin-types.c

index 4842ff3ea968b7239b465c4875aab1d2f9a269a8..56a79b4e249f023a003b412d7706e59ea0ad5f32 100644 (file)
@@ -513,7 +513,9 @@ builtins_manager::make_primitive_type (enum jit_builtin_type type_id)
     case BT_VOLATILE_PTR:
       return (m_ctxt->get_type (GCC_JIT_TYPE_VOID)->get_volatile ()
              ->get_pointer ());
-    // case BT_CONST_VOLATILE_PTR:
+    case BT_CONST_VOLATILE_PTR:
+      return (m_ctxt->get_type (GCC_JIT_TYPE_VOID)->get_const ()
+             ->get_volatile ()->get_pointer ());
     // case BT_PTRMODE:
     case BT_INT_PTR:
       return m_ctxt->get_type (GCC_JIT_TYPE_INT)->get_pointer ();
index 6c3b087ab981bb929492233316aba3566ebb7226..960163ed7d4f375d4a9a9e170053de3b359ed92e 100644 (file)
@@ -8,6 +8,7 @@ create_code (gcc_jit_context *ctxt, void *user_data)
 #define CHECK_BUILTIN(NAME) \
   CHECK_NON_NULL (gcc_jit_context_get_builtin_function (ctxt, NAME));
   
+  CHECK_BUILTIN ("__atomic_load");
   CHECK_BUILTIN ("__builtin_memcpy");
   CHECK_BUILTIN ("__builtin_sadd_overflow");