{"id":2175296,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2175296/?format=json","project":{"id":41,"url":"http://patchwork.ozlabs.org/api/1.0/projects/41/?format=json","name":"GNU C Library","link_name":"glibc","list_id":"libc-alpha.sourceware.org","list_email":"libc-alpha@sourceware.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251217175554.1157780-2-adhemerval.zanella@linaro.org>","date":"2025-12-17T17:51:47","name":"[1/8] math: Do not use __builtin_isgreater* and __builtin_isless* on clang","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e78617b53c13c82d89ace3ba65435b24f46808a5","submitter":{"id":66065,"url":"http://patchwork.ozlabs.org/api/1.0/people/66065/?format=json","name":"Adhemerval Zanella Netto","email":"adhemerval.zanella@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/glibc/patch/20251217175554.1157780-2-adhemerval.zanella@linaro.org/mbox/","series":[{"id":485739,"url":"http://patchwork.ozlabs.org/api/1.0/series/485739/?format=json","date":"2025-12-17T17:51:48","name":"Improve test when building with clang","version":1,"mbox":"http://patchwork.ozlabs.org/series/485739/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2175296/checks/","tags":{},"headers":{"Return-Path":"<libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org>","X-Original-To":["incoming@patchwork.ozlabs.org","libc-alpha@sourceware.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","libc-alpha@sourceware.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=t5muAWF2;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=t5muAWF2","sourceware.org;\n dmarc=pass (p=none dis=none) header.from=linaro.org","sourceware.org; spf=pass smtp.mailfrom=linaro.org","server2.sourceware.org;\n arc=none smtp.remote-ip=74.125.82.50"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4dWhM73NBSz1y0P\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 18 Dec 2025 04:56:50 +1100 (AEDT)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 5EC354BA2E2A\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 17 Dec 2025 17:56:47 +0000 (GMT)","from mail-dl1-f50.google.com (mail-dl1-f50.google.com\n [74.125.82.50])\n by sourceware.org (Postfix) with ESMTPS id 0DCB14BA2E1C\n for <libc-alpha@sourceware.org>; Wed, 17 Dec 2025 17:56:03 +0000 (GMT)","by mail-dl1-f50.google.com with SMTP id\n a92af1059eb24-11b6bc976d6so1303090c88.0\n for <libc-alpha@sourceware.org>; Wed, 17 Dec 2025 09:56:02 -0800 (PST)","from ubuntu-vm.. ([179.99.163.49]) by smtp.gmail.com with ESMTPSA id\n a92af1059eb24-12061a888a8sm433214c88.9.2025.12.17.09.56.00\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 17 Dec 2025 09:56:01 -0800 (PST)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 5EC354BA2E2A","OpenDKIM Filter v2.11.0 sourceware.org 0DCB14BA2E1C"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 0DCB14BA2E1C","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 0DCB14BA2E1C","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765994163; cv=none;\n b=NIrcbEE55JtgdnW+boqBTdoKN8ofMf9hZCGzkCmTwVnWtoxReZP0fuMx3tO0Fi0VscMqYkhiBX5Y1g7vS8aetW3fwkQfw+nKvLH42dRV73NCYVBkWmqcdAlru3XIelDLHHAwrOp2uNOw0LrO41JIyOiTP+vOO3cQkULJBZoUvEo=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1765994163; c=relaxed/simple;\n bh=VM8nAb6eXZk/IV1thIUMJKqJyv24zoH/qxdPq30X/1I=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=vVcD+0lW8Fwnv4uXk4V4MsJpNo6CvpNl9XaR0NVMfKg0Y4pNY9kvX3gDvuEs4bQEF7C7F9zhGT6XTm6FlytFDCWcksvcfLgbzJTPPeSSDkv/dTEI+RLadrfB/TNL1wa8mBDPDJW1Lc9y0D7HQ8Zr3c4sOgt4pDNuyAjC2FIowoE=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1765994162; x=1766598962; darn=sourceware.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=dZEo5sL5KfDWpaV8od4SIanYUU1cB/tSJ45fipaS5F4=;\n b=t5muAWF2c5P7gwKeofWAl5ltyDM27g8pNZ1qAPTgb6UJHV5vQz9jMJPz90B4TTLD5p\n x4lQIiZNmPeyNnQRRXWp0KXai1U/pK+g2Kh1KIcjpmT67e8NrbwMWd6o7fH+uD66V5um\n yInvHsGHJnl2efrKK2aTiaHlSVzc/vrmlc6lxyDMNDxNenT4vesv0fJrtG/d/kCljVRE\n eX7oPhMl8HDn2yqPtjOTqfmF/gFwGI41JjyHfPDPFHcUMSJF/jgGIPKJYXA19W+Tg8LT\n h1/mORDjkqTUAS6ilJ8V9tVhoxYCZ5Bw5NU7lLOvtLyj/p/ouyd/Jk1BolnxyKvzBdSQ\n Ma4A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1765994162; x=1766598962;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=dZEo5sL5KfDWpaV8od4SIanYUU1cB/tSJ45fipaS5F4=;\n b=UtVz0pHUbhbo6UAoAmlUncPqEbLKDW2CgdjZJpSllZvWsewAmQ9Oh//LeZirweL7d2\n s4S8tDWwbIIlqp7iC9NP0ynnlSWivWrGKAXN3pL8TytDERUZdGqYV0ZZHXQKht0HrZzh\n HgRTc5WA1vgt6TO/oct4w32NhKaLVcU5NRf/mxm/f1uNPJ+oIGVkBM32fDfQ3deS7iFI\n G4UGiqZfF1Ne6UtILW0LoW4uvdrM9E61lkE2qa1S8q79roqwudjPcTj07d8Hmhd8uKX7\n HO7BPa7tMuwpcmWYDv83IUCY+wDIi//HYYWA4J6ZGOz6t784RaIjZ+vfTS92UMVakSi2\n wyIg==","X-Gm-Message-State":"AOJu0YyO6TYaNwxFbnAW/MGgUxt0PnjoJhLTpJu0i52/PnQSKd6OSr0G\n b/B56oCGAm+Si5l2kUDlMfcWOv4/zIyWEQ84vIqcc8LeaqGOIVlQTMI4tMrKEETPNi92ERBHdyk\n nM8jj","X-Gm-Gg":"AY/fxX7C/4RuO6G21iQjRiQFENtjd6NiJjiHdFassrMwsoZTyL82luE1Gsm5MPZj4u7\n p+ZeSHPWpvMeVCKBPrA0L5iQbH12gOnkk1PkUsDt4AW1lhOHwaNvlyAmLrs/kwIVlsrybacRQpm\n D+iqVf800+ezUdwROP6ExEZqMEZU1fpW9S4hpBNrd4NubI78U9ZiocktIAJ571wacJ5NksBu6mC\n CDGwwTrLLUroJVq7l2edSKE258JPurhvU1ZXD+UqjXvQ00lnP2m+AE1R7BTBeImQs2d2Q/z/Twy\n UbAu5ccotr5WkK4EsQnahtUZBFRbSWblBaK6XZ48DvnqMb8tC7HXGFjKx2Jxtvcu6eEE8f2SbwB\n 09bBzl0Clvqpmgloumv37m+BZKb6C2SetbJ21VJ1GjoWWVk1LPHIUTzI/CBMgyc2356E7IwfDRk\n dP4SiL0FHVhb5zav0T1kcp/R0=","X-Google-Smtp-Source":"\n AGHT+IEd98FU1mUBC+TdMmHEg9N5ClKLhGtc0T0jj09FwVMpQ/53MyrhbXdNIEGrieeqGKduy9rS3A==","X-Received":"by 2002:a05:7022:e88e:b0:119:e569:f851 with SMTP id\n a92af1059eb24-1206193963cmr210944c88.8.1765994161617;\n Wed, 17 Dec 2025 09:56:01 -0800 (PST)","From":"Adhemerval Zanella <adhemerval.zanella@linaro.org>","To":"libc-alpha@sourceware.org","Cc":"\"H . J . Lu\" <hjl.tools@gmail.com>, Collin Funk <collin.funk1@gmail.com>,\n Sam James <sam@gentoo.org>","Subject":"[PATCH 1/8] math: Do not use __builtin_isgreater* and\n __builtin_isless* on clang","Date":"Wed, 17 Dec 2025 14:51:47 -0300","Message-ID":"<20251217175554.1157780-2-adhemerval.zanella@linaro.org>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20251217175554.1157780-1-adhemerval.zanella@linaro.org>","References":"<20251217175554.1157780-1-adhemerval.zanella@linaro.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libc-alpha@sourceware.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Libc-alpha mailing list <libc-alpha.sourceware.org>","List-Unsubscribe":"<https://sourceware.org/mailman/options/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe>","List-Archive":"<https://sourceware.org/pipermail/libc-alpha/>","List-Post":"<mailto:libc-alpha@sourceware.org>","List-Help":"<mailto:libc-alpha-request@sourceware.org?subject=help>","List-Subscribe":"<https://sourceware.org/mailman/listinfo/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=subscribe>","Errors-To":"libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org"},"content":"clang does not check for unordered numbers with builtins for 128-bit\nfloat types (both _Float128 on x86_64 or long double on aarch64) [1].\n\nFor instance, the code:\n\n  #ifdef __x86_64__\n  typedef __float128 FLOAT128_TYPE;\n  #elif defined (__aarch64__)\n  typedef long double FLOAT128_TYPE;\n  #endif\n\n  int foo (FLOAT128_TYPE x, FLOAT128_TYPE y)\n  {\n    return __builtin_isgreater (x, y);\n  }\n\nWill issue a __gttf2 call instead of a __unordtf2 followed by the\ncomparison.\n\nUsing the generic implementation fixes multiple issues with math tests,\nsuch as:\n\nFailure: fmax (0, qNaN): Exception \"Invalid operation\" set\nFailure: fmax (0, -qNaN): Exception \"Invalid operation\" set\nFailure: fmax (-0, qNaN): Exception \"Invalid operation\" set\nFailure: fmax (-0, -qNaN): Exception \"Invalid operation\" set\nFailure: fmax (9, qNaN): Exception \"Invalid operation\" set\nFailure: fmax (9, -qNaN): Exception \"Invalid operation\" set\nFailure: fmax (-9, qNaN): Exception \"Invalid operation\" set\nFailure: fmax (-9, -qNaN): Exception \"Invalid operation\" set\n\nIt has a small performance overhead due to the extra isunordered (which\ncould be omitted for float and double types). Using _Generic (similar to\nhow __MATH_TG) on a bivariadic function requires a lot of boilerplate\nmacros.\n\n[1] https://github.com/llvm/llvm-project/issues/172499\n---\n math/math.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/math/math.h b/math/math.h\nindex 26cea186fc..74b064d96e 100644\n--- a/math/math.h\n+++ b/math/math.h\n@@ -1433,7 +1433,7 @@ iszero (__T __val)\n #endif\n \n #ifdef __USE_ISOC99\n-# if __GNUC_PREREQ (3, 1)\n+# if __GNUC_PREREQ (3, 1) && !defined __clang__\n /* ISO C99 defines some macros to compare number while taking care for\n    unordered numbers.  Many FPUs provide special instructions to support\n    these operations.  Generic support in GCC for these as builtins went\n","prefixes":["1/8"]}