From patchwork Fri Jun 3 03:09:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoni Boucher X-Patchwork-Id: 54759 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9AD5138654B3 for ; Fri, 3 Jun 2022 03:10:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AD5138654B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654225813; bh=tA/NvYOEdlMoc3NXCRr8kPMe2fNLrsfV6735QnqiWWM=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=IlNyJZ+SAIWaziHzHPl4p3V2VEMfVOKl0iW7VmwjlLHkkfT/jBBuIYuylqvNvtZhU CQcbUw7MZT3zW/ESrd+eAzgLXg14ZW7LgFVUMNDomGnNPQ1Lu3SCHqISOXCcrTS6uM C8Zhop0F0AisjJGNDCGKxD6uqZuXFmh+/JKcCpMc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from sender4-pp-o91.zoho.com (sender4-pp-o91.zoho.com [136.143.188.91]) by sourceware.org (Postfix) with ESMTPS id 1480C385355F; Fri, 3 Jun 2022 03:09:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1480C385355F ARC-Seal: i=1; a=rsa-sha256; t=1654225780; cv=none; d=zohomail.com; s=zohoarc; b=QsVByBSQkt/HI/NC1KD3MJYQTqIv1KFOPmSzKb6Ee+1eFSLqod1K7QVNxGgyDviXAVcPcGOaAIaSKV+vSxoeOt7wItYEYBu6bXT6U+8Z0LsSs6TTpKlm6VGffQ1xEPO3uWGXu/2f0Te8bqGWwIPj6LHgSJ4iASsneysNC6uWaRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654225780; h=Content-Type:Date:From:MIME-Version:Message-ID:Subject:To; bh=tA/NvYOEdlMoc3NXCRr8kPMe2fNLrsfV6735QnqiWWM=; b=IGg1ePZpC+m0KRcIzBAu7OT0hdYc8Gq9YUZpeVJetGxqSNnKlUfKAW3Gs/hB23f+AhoAwpkJuag/MLu93VOb4vTgfuodgeFItwIm1Yuy5SFofsKQpHdOF05LLdOLEtzw+Pypo564kmNJ1oq0hClhlBBtxqX1TaHWc8BobGyE4BU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zoho.com; spf=pass smtp.mailfrom=bouanto@zoho.com; dmarc=pass header.from= Received: from [192.168.1.174] (38.87.11.6 [38.87.11.6]) by mx.zohomail.com with SMTPS id 1654225778363330.00830666342426; Thu, 2 Jun 2022 20:09:38 -0700 (PDT) Message-ID: Subject: [PATCH] libgccjit: Support getting the size of a float To: gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Date: Thu, 02 Jun 2022 23:09:36 -0400 User-Agent: Evolution 3.44.2 MIME-Version: 1.0 X-Zoho-Virus-Status: 1 X-ZohoMailClient: External X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Antoni Boucher via Gcc-patches From: Antoni Boucher Reply-To: Antoni Boucher Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi. The attached patch fix bug 105829: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105829 Thanks for the review. From 5d75fd342cdcea94a785312252be0c0046afdf43 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Wed, 4 May 2022 21:42:44 -0400 Subject: [PATCH] libgccjit: Support getting the size of a float 2022-06-02 Antoni Boucher gcc/jit/ PR target/105829 * libgccjit.cc: Add support for floating-point types in gcc_jit_type_get_size. gcc/testsuite/ PR target/105829 * jit.dg/test-types.c: Add tests for gcc_jit_type_get_size. --- gcc/jit/libgccjit.cc | 4 ++-- gcc/testsuite/jit.dg/test-types.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/jit/libgccjit.cc b/gcc/jit/libgccjit.cc index cc6486c9cad..12e7679988b 100644 --- a/gcc/jit/libgccjit.cc +++ b/gcc/jit/libgccjit.cc @@ -545,8 +545,8 @@ gcc_jit_type_get_size (gcc_jit_type *type) { RETURN_VAL_IF_FAIL (type, -1, NULL, NULL, "NULL type"); RETURN_VAL_IF_FAIL - (type->is_int (), -1, NULL, NULL, - "only getting the size of an integer type is supported for now"); + (type->is_int () || type->is_float (), -1, NULL, NULL, + "only getting the size of an int or float type is supported for now"); return type->get_size (); } diff --git a/gcc/testsuite/jit.dg/test-types.c b/gcc/testsuite/jit.dg/test-types.c index 6836597d14e..53bdeafed61 100644 --- a/gcc/testsuite/jit.dg/test-types.c +++ b/gcc/testsuite/jit.dg/test-types.c @@ -489,4 +489,7 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) CHECK (gcc_jit_compatible_types ( gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_LONG), gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT64_T))); + + CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_FLOAT)), 4); + CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_DOUBLE)), 8); } -- 2.26.2.7.g19db9cfb68.dirty