From bdfadb16d7928eb6bde5bf6c4e7b499c18438a31 Mon Sep 17 00:00:00 2001 From: Adrian Kuegel Date: Mon, 4 Nov 2024 07:06:59 +0000 Subject: [PATCH 1/3] [mlir] Apply ClangTidy findings Remove unused using declarations --- mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp index aa5a52a21f12..5f86c0cd7470 100644 --- a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp +++ b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp @@ -31,9 +31,6 @@ using namespace mlir; using llvm::yaml::Input; -using llvm::yaml::MappingTraits; -using llvm::yaml::ScalarEnumerationTraits; -using llvm::yaml::ScalarTraits; #define DEBUG_TYPE "linalg-ods-gen" From 2ff41b4eee0c6e30eaa7119b893fde4bdd010045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20Sch=C3=BCtt?= Date: Mon, 4 Nov 2024 08:18:37 +0100 Subject: [PATCH 2/3] =?UTF-8?q?[GlobalISel][AArch64]=20Legalize=20G=5FUADD?= =?UTF-8?q?SAT,=20G=5FSADDSAT,=20G=5FUSUBSAT,=20and=20G=E2=80=A6=20(#11466?= =?UTF-8?q?4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …_SSUBSAT sve-int-imm.ll also tests saturation, but it has unsupported splats. --- .../AArch64/GISel/AArch64LegalizerInfo.cpp | 1 + .../CodeGen/AArch64/sve-saturating-arith.ll | 168 ++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 llvm/test/CodeGen/AArch64/sve-saturating-arith.ll diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp index f162d1c2973c..8851ad7ac350 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp @@ -1280,6 +1280,7 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST) getActionDefinitionsBuilder({G_UADDSAT, G_SADDSAT, G_USUBSAT, G_SSUBSAT}) .legalFor({v2s64, v2s32, v4s32, v4s16, v8s16, v8s8, v16s8}) + .legalFor(HasSVE, {nxv2s64, nxv4s32, nxv8s16, nxv16s8}) .clampNumElements(0, v8s8, v16s8) .clampNumElements(0, v4s16, v8s16) .clampNumElements(0, v2s32, v4s32) diff --git a/llvm/test/CodeGen/AArch64/sve-saturating-arith.ll b/llvm/test/CodeGen/AArch64/sve-saturating-arith.ll new file mode 100644 index 000000000000..d4a66b70028d --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve-saturating-arith.ll @@ -0,0 +1,168 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 +; RUN: llc -mtriple=aarch64 -mattr=+sve -verify-machineinstrs %s -o - | FileCheck %s +; RUN: llc -mtriple=aarch64 -mattr=+sve -aarch64-enable-gisel-sve=1 -global-isel -global-isel-abort=2 -verify-machineinstrs %s -o - 2>&1 | FileCheck %s + +; SQADD +define @sqadd_i8_low( %a, %b) { +; CHECK-LABEL: sqadd_i8_low: +; CHECK: // %bb.0: +; CHECK-NEXT: sqadd z0.b, z0.b, z1.b +; CHECK-NEXT: ret + %res = call @llvm.sadd.sat.nxv16i8( %a, %b) + ret %res +} + +define @sqadd_i16_low( %a, %b) { +; CHECK-LABEL: sqadd_i16_low: +; CHECK: // %bb.0: +; CHECK-NEXT: sqadd z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.sadd.sat.nxv8i16( %a, %b) + ret %res +} + +define @sqadd_i32_low( %a, %b) { +; CHECK-LABEL: sqadd_i32_low: +; CHECK: // %bb.0: +; CHECK-NEXT: sqadd z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.sadd.sat.nxv4i32( %a, %b) + ret %res +} + +define @sqadd_i64_low( %a, %b) { +; CHECK-LABEL: sqadd_i64_low: +; CHECK: // %bb.0: +; CHECK-NEXT: sqadd z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.sadd.sat.nxv2i64( %a, %b) + ret %res +} + +; UQADD +define @uqadd_i8_low( %a, %b) { +; CHECK-LABEL: uqadd_i8_low: +; CHECK: // %bb.0: +; CHECK-NEXT: uqadd z0.b, z0.b, z1.b +; CHECK-NEXT: ret + %res = call @llvm.uadd.sat.nxv16i8( %a, %b) + ret %res +} + +define @uqadd_i16_low( %a, %b) { +; CHECK-LABEL: uqadd_i16_low: +; CHECK: // %bb.0: +; CHECK-NEXT: uqadd z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.uadd.sat.nxv8i16( %a, %b) + ret %res +} + +define @uqadd_i32_low( %a, %b) { +; CHECK-LABEL: uqadd_i32_low: +; CHECK: // %bb.0: +; CHECK-NEXT: uqadd z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.uadd.sat.nxv4i32( %a, %b) + ret %res +} + +define @uqadd_i64_low( %a, %b) { +; CHECK-LABEL: uqadd_i64_low: +; CHECK: // %bb.0: +; CHECK-NEXT: uqadd z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.uadd.sat.nxv2i64( %a, %b) + ret %res +} + +; SQSUB +define @sqsub_i8_low( %a, %b) { +; CHECK-LABEL: sqsub_i8_low: +; CHECK: // %bb.0: +; CHECK-NEXT: sqsub z0.b, z0.b, z1.b +; CHECK-NEXT: ret + %res = call @llvm.ssub.sat.nxv16i8( %a, %b) + ret %res +} + +define @sqsub_i16_low( %a, %b) { +; CHECK-LABEL: sqsub_i16_low: +; CHECK: // %bb.0: +; CHECK-NEXT: sqsub z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.ssub.sat.nxv8i16( %a, %b) + ret %res +} + +define @sqsub_i32_low( %a, %b) { +; CHECK-LABEL: sqsub_i32_low: +; CHECK: // %bb.0: +; CHECK-NEXT: sqsub z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.ssub.sat.nxv4i32( %a, %b) + ret %res +} + +define @sqsub_i64_low( %a, %b) { +; CHECK-LABEL: sqsub_i64_low: +; CHECK: // %bb.0: +; CHECK-NEXT: sqsub z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.ssub.sat.nxv2i64( %a, %b) + ret %res +} + +; UQSUB +define @uqsub_i8_low( %a, %b) { +; CHECK-LABEL: uqsub_i8_low: +; CHECK: // %bb.0: +; CHECK-NEXT: uqsub z0.b, z0.b, z1.b +; CHECK-NEXT: ret + %res = call @llvm.usub.sat.nxv16i8( %a, %b) + ret %res +} + +define @uqsub_i16_low( %a, %b) { +; CHECK-LABEL: uqsub_i16_low: +; CHECK: // %bb.0: +; CHECK-NEXT: uqsub z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.usub.sat.nxv8i16( %a, %b) + ret %res +} + +define @uqsub_i32_low( %a, %b) { +; CHECK-LABEL: uqsub_i32_low: +; CHECK: // %bb.0: +; CHECK-NEXT: uqsub z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.usub.sat.nxv4i32( %a, %b) + ret %res +} + +define @uqsub_i64_low( %a, %b) { +; CHECK-LABEL: uqsub_i64_low: +; CHECK: // %bb.0: +; CHECK-NEXT: uqsub z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.usub.sat.nxv2i64( %a, %b) + ret %res +} + +declare @llvm.sadd.sat.nxv16i8(, ) +declare @llvm.sadd.sat.nxv8i16(, ) +declare @llvm.sadd.sat.nxv4i32(, ) +declare @llvm.sadd.sat.nxv2i64(, ) +declare @llvm.uadd.sat.nxv16i8(, ) +declare @llvm.uadd.sat.nxv8i16(, ) +declare @llvm.uadd.sat.nxv4i32(, ) +declare @llvm.uadd.sat.nxv2i64(, ) +declare @llvm.ssub.sat.nxv16i8(, ) +declare @llvm.ssub.sat.nxv8i16(, ) +declare @llvm.ssub.sat.nxv4i32(, ) +declare @llvm.ssub.sat.nxv2i64(, ) +declare @llvm.usub.sat.nxv16i8(, ) +declare @llvm.usub.sat.nxv8i16(, ) +declare @llvm.usub.sat.nxv4i32(, ) +declare @llvm.usub.sat.nxv2i64(, ) From 0067b79feca267ca0d70fb4af8c08c9b78cdb418 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 3 Nov 2024 23:24:07 -0800 Subject: [PATCH 3/3] [memprof] Use MinimumSupportedVersion in place of Verion0 (NFC) (#114723) I'm planning to remove old versions of the MemProf indexed formats at some point. Replacing these occurrences of Version0 with MinimumSupportedVersion allows me to touch fewer places when I remove old versions in the future. Note that these two parameters being touched in this patch have nothing to do with the default MemProf version that llvm-profdata uses, which is controlled by MemProfVersionRequested in llvm-profdata.cpp. --- llvm/include/llvm/ProfileData/InstrProfReader.h | 3 ++- llvm/include/llvm/ProfileData/InstrProfWriter.h | 16 ++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h index 00b361f4ad1c..6be3fad41824 100644 --- a/llvm/include/llvm/ProfileData/InstrProfReader.h +++ b/llvm/include/llvm/ProfileData/InstrProfReader.h @@ -669,7 +669,8 @@ class InstrProfReaderRemapper { class IndexedMemProfReader { private: /// The MemProf version. - memprof::IndexedVersion Version = memprof::Version0; + memprof::IndexedVersion Version = + static_cast(memprof::MinimumSupportedVersion); /// MemProf profile schema (if available). memprof::MemProfSchema Schema; /// MemProf record profile data on-disk indexed via llvm::md5(FunctionName). diff --git a/llvm/include/llvm/ProfileData/InstrProfWriter.h b/llvm/include/llvm/ProfileData/InstrProfWriter.h index 559549b0a22c..199e565bead0 100644 --- a/llvm/include/llvm/ProfileData/InstrProfWriter.h +++ b/llvm/include/llvm/ProfileData/InstrProfWriter.h @@ -86,12 +86,16 @@ class InstrProfWriter { // MemprofGenerateRandomHotness is enabled. The random seed can be either // provided by MemprofGenerateRandomHotnessSeed, or if that is 0, one will be // generated in the writer using the current time. - InstrProfWriter( - bool Sparse = false, uint64_t TemporalProfTraceReservoirSize = 0, - uint64_t MaxTemporalProfTraceLength = 0, bool WritePrevVersion = false, - memprof::IndexedVersion MemProfVersionRequested = memprof::Version0, - bool MemProfFullSchema = false, bool MemprofGenerateRandomHotness = false, - unsigned MemprofGenerateRandomHotnessSeed = 0); + InstrProfWriter(bool Sparse = false, + uint64_t TemporalProfTraceReservoirSize = 0, + uint64_t MaxTemporalProfTraceLength = 0, + bool WritePrevVersion = false, + memprof::IndexedVersion MemProfVersionRequested = + static_cast( + memprof::MinimumSupportedVersion), + bool MemProfFullSchema = false, + bool MemprofGenerateRandomHotness = false, + unsigned MemprofGenerateRandomHotnessSeed = 0); ~InstrProfWriter(); StringMap &getProfileData() { return FunctionData; }